diff --git a/README.md b/README.md index 0a8beda..45da5a1 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: diff --git a/README.zh_CN.md b/README.zh_CN.md index 1015dcc..3365cc2 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -30,8 +30,7 @@ MongoDB 官方 driver 及 API。 插件对一些常用 API 进行了简单封装以简化使用,同时保留了所有原版属性。例如,使用原版 API 进行一次查找需要写 ```js -db - .collection('name') +db.collection('name') .find(query, options) .skip(skip) .limit(limit) @@ -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/)。 diff --git a/package.json b/package.json index 69ab5af..e1c7b6b 100644 --- a/package.json +++ b/package.json @@ -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"