September 2017
Intermediate to advanced
450 pages
11h 24m
English
Mongoose's model API provides tools for working with predefined Mongoose Model's. It's the primary API that you will use to manipulate documents in MongoDB:
| Property | Example | Description |
| remove | Posts.remove({title: 'foobar'}); | Removes matching documents from the db. |
| aggregate | Posts.aggregate() .group({}) .select({}); | Performs data aggregations on the models collection. |
| bulkWrite | Posts.bulkWrite([{ insertOne: {} }, { updateOne: {} }, { deleteOne: {} }]); | Combines multiple create, update, and delete operations into a single MongoDB request. |
| count | Posts.count({}); | Retrieves the count of items that match. |
| create | Posts.create(new Post({})); | Creates and saves one or more documents passed to it. |
| deleteMany | Posts.deleteMany({}); ... |
Read now
Unlock full access