Skip to content

Tag Archives: Mongoose-Model-API

The Model.listIndexes() method of Mongoose API Lists the indexes currently defined in MongoDB, whether they are the promise, undefined or void. Syntax: Model_Name.listIndexes() Parameters: The… Read More
The Model.init() method of Mongoose API is responsible for building indexes. Although, Mongoose calls this function automatically when a model is created using mongoose.model() or… Read More
The Model.prototype.modelName property of the Mongoose API is used to return the name of the model.  Syntax: Model.prototype.modelName.db Returns: The Model.prototype.modelName property returns the name… Read More
The Model.deleteOne() method of the Mongoose API is used to delete a document from the collection. We can provide an object of the field to… Read More
The Model.deleteMany() method of the Mongoose API is used to delete more than one document in the collection at a time in one go. We… Read More
The Model.prototype.collection property of the Mongoose API is used to display collection-related information on any model. It showcases collections that are being used by models.… Read More
The Model.count() method of the Mongoose API is used to count the number of documents present in the collection based on the given filter condition.… Read More
The Model.bulkWrite() method of the Mongoose API is used to perform multiple operations in one command. It can insert multiple documents, can update one or… Read More
The Model.prototype.baseModelName property of the Mongoose API is used to return the baseModelName as the name of the base model, if this is a discriminator… Read More
The Model.prototype.discriminators property of the Mongoose API is used to return the registered discriminators for the model. Syntax: Model_Name.discriminators Returns: The Model.prototype.discriminators property returns the… Read More
The Model.prototype.base property of the Mongoose API is used to return the base Mongoose instance the model uses. Syntax: Model_Name.base Return Value: The Model.prototype.base property… Read More
The Model.prototype.schema property of the Mongoose API is used to return the schema which the model uses. Syntax: Model_Name.schema Returns: The Model.prototype.modelName property returns the… Read More
The Model.events property of Mongoose API is used to return the model’s events instance. The instance of the event contains the fields like _events, _eventsCount,… Read More
The Model.inspect() method of the Mongoose API is used to get the model’s name in the database. This method works on any model object which… Read More
The Model.exists() method of the Mongoose API is used to find documents in the database. This method returns a document with “_id” if at least… Read More