Additional properties to attach to the query when calling save() and isNew is false.
Performs aggregations on the models collection.
Performs aggregations on the models collection.
aggregation pipeline operator(s) or operator array
the callback
aggregate([...], [callback])
Performs aggregations on the models collection.
Performs aggregations on the models collection.
aggregation pipeline operator(s) or operator array
the Aggregate
aggregate([...], [callback])
Base Mongoose instance the model uses.
If this is a discriminator model, baseModelName is the name of the base model.
Collection the model uses.
Counts number of matching documents in a database collection.
Counts number of matching documents in a database collection.
the given query/conditions
the callback
count(conditions, [callback])
Counts number of matching documents in a database collection.
Counts number of matching documents in a database collection.
the given query/conditions
the promise of the count
count(conditions, [callback])
Shortcut for saving one or more documents to the database.
Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.
a document or array of documents
the callback
Shortcut for saving one or more documents to the database.
Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.
a document or array of documents
the callback
Shortcut for saving one or more documents to the database.
Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.
an array of documents to create
the created documents
Shortcut for saving one or more documents to the database.
Shortcut for saving one or more documents to the database. MyModel.create(docs) does new MyModel(doc).save() for every doc in docs.
a document to create
the created documents
Connection the model uses.
Adds a discriminator type.
Adds a discriminator type.
the discriminator model name
the discriminator model schema
Registered discriminators for this model.
Creates a Query for a distinct operation.
Creates a Query for a distinct operation.
the field
the callback
Creates a Query for a distinct operation.
Creates a Query for a distinct operation.
the field
the optional condition
the callback
Creates a Query for a distinct operation.
Creates a Query for a distinct operation.
the field
the optional condition
the resulting query
Sends ensureIndex commands to mongo for each index declared in the schema.
Sends ensureIndex commands to mongo for each index declared in the schema.
the internal options
the optional callback
Sends ensureIndex commands to mongo for each index declared in the schema.
Sends ensureIndex commands to mongo for each index declared in the schema.
the internal options
a promise of the completion
Finds documents
Finds documents
the given conditions/query
the optional callback
Finds documents
Finds documents
the given conditions/query
a Query
Finds a single document by its _id field.
Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().
the value of _id
to query by
the optional callback
Finds a single document by its _id field.
Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().
the value of _id
to query by
the optional fields to return
the optional callback
Finds a single document by its _id field.
Finds a single document by its _id field. findById(id) is almost* equivalent to findOne({ _id: id }). If you want to query by a document's _id, use findById() instead of findOne().
the value of _id
to query by
the optional fields to return
the Query
Issue a mongodb findAndModify remove command by a document's _id field.
Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).
the value of _id
to query by
the optional callback
findByIdAndRemove(id, [options], [callback])
Issue a mongodb findAndModify remove command by a document's _id field.
Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).
the value of _id
to query by
the optional options
the optional callback
findByIdAndRemove(id, [options], [callback])
Issue a mongodb findAndModify remove command by a document's _id field.
Issue a mongodb findAndModify remove command by a document's _id field. findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).
the value of _id
to query by
the optional options
a promise of the results
findByIdAndRemove(id, [options], [callback])
Issues a mongodb findAndModify update command by a document's _id field.
Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).
the value of _id
to query by
the update sub-document
the optional options
the optional callback
Issues a mongodb findAndModify update command by a document's _id field.
Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).
the value of _id
to query by
the update sub-document
the optional callback
Issues a mongodb findAndModify update command by a document's _id field.
Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) is equivalent to findOneAndUpdate({ _id: id }, ...).
the value of _id
to query by
the update sub-document
the optional options
the promise of the document
Finds one document.
Finds one document.
the conditions/query
the optional fields to return
the option callback
Finds one document.
Finds one document.
the conditions/query
the option callback
Finds one document.
Finds one document.
the conditions/query
the optional fields to return
the Query
Issue a mongodb findAndModify remove command.
Issue a mongodb findAndModify remove command.
the conditions/query
the option callback
Issue a mongodb findAndModify remove command.
Issue a mongodb findAndModify remove command.
the conditions/query
the optional options
the option callback
Issue a mongodb findAndModify remove command.
Issue a mongodb findAndModify remove command.
the conditions/query
the optional options
the promise of the removed document
Issues a mongodb findAndModify update command.
Issues a mongodb findAndModify update command.
the conditions/query
the sub-document update
the option callback
Issues a mongodb findAndModify update command.
Issues a mongodb findAndModify update command.
the conditions/query
the sub-document update
the optional options
the option callback
Issues a mongodb findAndModify update command.
Issues a mongodb findAndModify update command.
the conditions/query
the sub-document update
the optional options
the promise of the updated document
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.
the documents to insert
the option callback
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.
the documents to insert
the optional options
the option callback
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid.
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.
the documents to insert
the optional options
a promise of the inserted documents
Executes a mapReduce command.
Executes a mapReduce command.
an object specifying map-reduce options
the optional callback
Executes a mapReduce command.
Executes a mapReduce command.
an object specifying map-reduce options
the promise of the results
Returns another Model instance.
Returns another Model instance.
the model type
the model name
the model
The name of the model
Populates document references.
Populates document references.
Either a single document or array of documents to populate.
A hash of key/val (path, options) used for population.
Optional callback, executed upon completion. Receives err
and the doc(s)
.
Populates document references.
Populates document references.
an array of documents to populate.
A hash of key/val (path, options) used for population.
the doc(s)
.
Populates document references.
Populates document references.
Either a single document or array of documents to populate.
A hash of key/val (path, options) used for population.
Optional callback, executed upon completion. Receives err
and the doc(s)
.
Populates document references.
Populates document references.
a single document to populate.
A hash of key/val (path, options) used for population.
the doc(s)
.
Removes documents from the collection.
Removes documents from the collection.
the conditions/query
the optional callback
Removes documents from the collection.
Removes documents from the collection.
the conditions/query
the promise of the removed document
The Schema the model uses.
Updates documents in the database without returning them.
Updates documents in the database without returning them.
the conditions/query
the sub-document to use in the update
the optional callback
Updates documents in the database without returning them.
Updates documents in the database without returning them.
the conditions/query
the sub-document to use in the update
the optional options
the optional callback
Updates documents in the database without returning them.
Updates documents in the database without returning them.
the sub-document to use in the update
the optional options
the promise of the updated document
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
the conditions/query
the sub-document to use in the update
the optional callback
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
the conditions/query
the sub-document to use in the update
the optional options
the optional callback
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
Same as update(), except MongoDB will update all documents that match criteria (as opposed to just the first one) regardless of the value of the multi option.
the sub-document to use in the update
the optional options
the promise of the updated document
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
the conditions/query
the sub-document to use in the update
the optional callback
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
the conditions/query
the sub-document to use in the update
the optional options
the optional callback
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
Same as update(), except MongoDB will update only the first document that matches criteria regardless of the value of the multi option.
the conditions/query
the sub-document to use in the update
the optional options
the promise of the updated document
Creates a Query, applies the passed conditions, and returns the Query.
Creates a Query, applies the passed conditions, and returns the Query.
the given path/field
the optional value
the QueryOperator
Mongoose Model