Skip to content

Commit

Permalink
release 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brickyang committed Dec 15, 2018
1 parent 1eb463d commit 71ebf06
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ It wraps some frequently-used API to make it easy to use but keep all properties
as it is. For example, to find a document you need this with official API

```js
db
.collection('name')
db.collection('name')
.find(query, options)
.skip(skip)
.limit(limit)
Expand Down Expand Up @@ -169,28 +168,31 @@ The `args` is an object provides the arguments to official API.

You can access these properties of `app.mongo`

* **db**: the db instance connected
* **config**: the client config, typically is an object includes the host, port, name, user, password and options.
- **db**: the db instance connected
- **config**: the client config, typically is an object includes the host, port, name, user, password and options.

## Methods

Until now, this plugin provides these functions:

* **connect**: automatically connected, no need to call
* **insertOne**
* **insertMany**
* **findOneAndUpdate**
* **findOneAndReplace**
* **findOneAndDelete**
* **updateMany**
* **deleteMany**
* **find**
* **count**
* **distinct**
* **createIndex**
* **listCollection**
* **createCollection**
* **aggregate**: need version 2.2.0 and above
- **connect**: automatically connected, no need to call
- **insertOne**
- **insertMany**
- **findOne**
- **findOneAndUpdate**
- **findOneAndReplace**
- **findOneAndDelete**
- **updateMany**
- **deleteMany**
- **find**
- **count**: DEPRECATED
- **countDocuments**
- **estimatedDocumentCount**
- **distinct**
- **createIndex**
- **listCollection**
- **createCollection**
- **aggregate**: need version 2.2.0 and above

You can always use `app.mongo.db` to use all official APIs. Check the
APIs here:
Expand Down
40 changes: 21 additions & 19 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ MongoDB 官方 driver 及 API。
插件对一些常用 API 进行了简单封装以简化使用,同时保留了所有原版属性。例如,使用原版 API 进行一次查找需要写

```js
db
.collection('name')
db.collection('name')
.find(query, options)
.skip(skip)
.limit(limit)
Expand Down Expand Up @@ -168,28 +167,31 @@ app.mongo.get('db1').insertOne('name', args);

`app.mongo` 上提供下列属性:

* **db**:已连接的数据库实例
* **config**:数据库连接设置,即 `config.mongo.client`
- **db**:已连接的数据库实例
- **config**:数据库连接设置,即 `config.mongo.client`

## API

目前插件提供的 API 包括:

* **connect**:应用启动时会自动连接,不需要手动操作
* **insertOne**
* **insertMany**
* **findOneAndUpdate**
* **findOneAndReplace**
* **findOneAndDelete**
* **updateMany**
* **deleteMany**
* **find**
* **count**
* **distinct**
* **createIndex**
* **listCollection**
* **createCollection**
* **aggregate**:2.2.0 及以上版本提供(建议使用 3.x 版本)
- **connect**:应用启动时会自动连接,不需要手动操作
- **insertOne**
- **insertMany**
- **findOne**
- **findOneAndUpdate**
- **findOneAndReplace**
- **findOneAndDelete**
- **updateMany**
- **deleteMany**
- **find**
- **count**: 已过时
- **countDocuments**
- **estimatedDocumentCount**
- **distinct**
- **createIndex**
- **listCollection**
- **createCollection**
- **aggregate**:2.2.0 及以上版本提供(建议使用 3.x 版本)

当然,在任何时候你也都可以使用 `app.mongo.db` 调用所有 API。在这里查看所有
API:[Node.js MongoDB Driver API](http://mongodb.github.io/node-mongodb-native/3.0/api/)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "egg-mongo-native",
"version": "3.2.2",
"version": "3.3.0",
"description": "MongoDB egg.js plugin using native driver.",
"eggPlugin": {
"name": "mongo"
Expand Down

0 comments on commit 71ebf06

Please sign in to comment.