3.1.5 • Published 7 years ago

node.mongo v3.1.5

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

node.mongo

npm

node mongo library

Installation

$ npm install node.mongo

Usage

const mongo = require("node.mongo")(url, {
  timestamp: true, // auto add createdTime and updatedTime 
  createdTime: 'createdTime', // customer createdTime field (timestamp=true)
  updatedTime: 'updatedTime' // customer createdTime field (timestamp=true)
});

const res = await mongo.findOne(collection,condition);

Example

const mongo = require("node.mongo")("mongodb://localhost/test");

const query = await mongo.findOne("test",{});

API Methods

  • collections
    • return all collections in db
  • collection(name)
    • return specified collection (for other methods not defined)
  • count(collection,query,options)
    • return number of result in specified collection
  • insert(collection,data)
    • insert a series of new item
  • update(collection,filter,data,options)
    • upsert many items
  • updateOne(collection,filter,data,options)
    • upsert a new item (auto upsert)
  • find(collection,filter,condition,cursor)
    • return a group of items (array) (cursor = false)
    • return a MongoCursor object (object) (cursor = true)
  • findOne(collectionName,filter,condition)
    • return first item accord with filter
  • femove(collectionName,filter,option)
    • remove any numbers of document
  • aggregate(collectionName,pipeline, options)
    • Execute an aggregation framework pipeline against the collection
3.1.5

7 years ago

3.1.4

7 years ago

3.1.3

7 years ago

3.1.2

7 years ago

3.1.1

7 years ago

3.0.4

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

3.0.0-beta3

7 years ago

3.0.0-beta2

7 years ago

3.0.0-beta1

7 years ago

2.1.6

8 years ago

2.1.5

8 years ago

2.1.4

8 years ago

2.1.3

8 years ago

2.1.2

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago