MCPcopy Create free account

hub / github.com/Automattic/mongoose / functions

Functions1,018 in github.com/Automattic/mongoose

↓ 129 callersMethodcreate
Creates a new document or documents
types/models.d.ts:268
↓ 102 callersMethodfindOne
Finds one document.
types/models.d.ts:366
↓ 96 callersFunctionmodel
()
test/errors.validation.test.js:226
↓ 94 callersMethodfind
Creates a `find` query: gets a list of documents that match `filter`.
types/models.d.ts:555
↓ 91 callersMethodget
* Overwrites native Map's `get()` function to support Mongoose getters. * * @api public * @method get * @memberOf Map
lib/types/map.js:54
↓ 83 callersMethodset
(option, value)
lib/schema/map.js:20
↓ 81 callersMethodclose
()
lib/cursor/ChangeStream.js:141
↓ 66 callersMethodtoString
* toString helper * TODO remove? This defaults to `${this.name}: ${this.message}` * @api private
lib/error/validator.js:40
↓ 63 callersMethodtoObject
(options)
lib/types/map.js:212
↓ 52 callersMethodpopulate
Populates document references.
types/models.d.ts:489
↓ 44 callersMethodfindById
* 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'
types/models.d.ts:344
↓ 42 callersFunctiondone
(err)
lib/model.js:1730
↓ 35 callersFunctionclone
* Object clone with Mongoose natives support. * * If options.minimize is true, creates a minimal data object. Empty objects and undefined values wil
lib/helpers/clone.js:29
↓ 35 callersMethoddiscriminator
Adds a discriminator type.
types/models.d.ts:14
↓ 34 callersMethodinit
* This function is responsible for building [indexes](https://www.mongodb.com/docs/manual/indexes/), * unless [`autoIndex`](http://mongoosejs.com
types/models.d.ts:404
↓ 33 callersMethoddeleteMany
* Deletes all of the documents that match `conditions` from the collection. * Behaves like `remove()`, but deletes all documents that match `cond
types/models.d.ts:288
↓ 30 callersFunctioncallback
(err)
lib/schema/documentarray.js:255
↓ 29 callersMethodcast
(val, doc, init)
lib/schema/map.js:24
↓ 29 callersMethodfindOneAndUpdate
Creates a `findOneAndUpdate` query: atomically find the first document that matches `filter` and apply `update`.
types/models.d.ts:714
↓ 29 callersMethodon
(event, handler)
lib/cursor/ChangeStream.js:127
↓ 29 callersMethodupdateOne
Creates a `updateOne` query: updates the first document that matches `filter` with `update`.
types/models.d.ts:764
↓ 29 callersMethodvalueOf
()
test/helpers/clone.test.js:229
↓ 28 callersFunctionget
(v)
test/schema.test.js:2648
↓ 28 callersMethodvalidate
Casts and validates the given object against this model's schema, passing the given `context` to custom validators.
types/models.d.ts:505
↓ 26 callersMethodclone
()
lib/schema/map.js:62
↓ 25 callersFunctionfn
()
test/helpers/cursor.eachAsync.test.js:44
↓ 25 callersMethodwhere
Creates a Query, applies the passed conditions, and returns the Query.
types/models.d.ts:771
↓ 24 callersFunctionnext
(cb)
test/helpers/cursor.eachAsync.test.js:15
↓ 21 callersMethodinsertMany
Inserts one or more new documents as a single `insertMany` call to the MongoDB server.
types/models.d.ts:407
↓ 20 callersMethodaggregate
(pipeline?: PipelineStage[], options?: AggregateOptions)
types/models.d.ts:205
↓ 19 callersMethodcollection
()
test/driver.test.js:26
↓ 19 callersFunctionisBsonType
* Get the bson type, if it exists * @api private
lib/helpers/isBsonType.js:8
↓ 18 callersMethoddeleteOne
* Deletes the first document that matches `conditions` from the collection. * Behaves like `remove()`, but deletes at most one document regardles
types/models.d.ts:313
↓ 17 callersMethodinsertOne
(doc, options)
test/driver.test.js:72
↓ 15 callersMethodfindByIdAndUpdate
Creates a `findOneAndUpdate` query, filtering by the given `_id`.
types/models.d.ts:618
↓ 14 callersMethodinspect
()
lib/types/map.js:258
↓ 14 callersMethodonce
(event, handler)
lib/cursor/ChangeStream.js:132
↓ 13 callersMethodcountDocuments
Creates a `countDocuments` query: counts the number of documents that match `filter`.
types/models.d.ts:256
↓ 13 callersMethodtoJSON
()
lib/error/cast.js:33
↓ 12 callersFunctioncb
(err)
lib/schema/documentarray.js:233
↓ 12 callersFunctionnext
(err)
lib/model.js:4354
↓ 11 callersMethodfindOneAndDelete
Creates a `findOneAndDelete` query: atomically finds the given document, deletes it, and returns the document as it was before deletion.
types/models.d.ts:655
↓ 10 callersFunctionSchema
* Schema constructor. * * #### Example: * * const child = new Schema({ name: String }); * const schema = new Schema({ name: String, age:
lib/schema.js:104
↓ 10 callersMethodbulkWrite
* Sends multiple `insertOne`, `updateOne`, `updateMany`, `replaceOne`, * `deleteOne`, and/or `deleteMany` operations to the MongoDB server in one
types/models.d.ts:227
↓ 10 callersMethodcreateCollection
* Create the collection for this model. By default, if no indexes are specified, * mongoose will not create the collection for the model until an
types/models.d.ts:278
↓ 10 callersMethodsyncIndexes
* Makes the indexes in MongoDB match the indexes defined in this model's * schema. This function will drop any indexes that are not defined in
types/indexes.d.ts:46
↓ 10 callersMethodupdateMany
Creates a `updateMany` query: updates all documents that match `filter` with `update`.
types/models.d.ts:757
↓ 9 callersMethodcount
Creates a `count` query: counts the number of documents that match `filter`.
types/models.d.ts:247
↓ 9 callersMethoddelete
* Overwrites native Map's `delete()` function to support change tracking. * * @api public * @method delete * @memberOf Map
lib/types/map.js:191
↓ 9 callersMethodfindOneAndReplace
Creates a `findOneAndReplace` query: atomically finds the given document and replaces it with `replacement`.
types/models.d.ts:681
↓ 9 callersMethodhydrate
* Shortcut for creating a new Document from existing raw data, pre-saved in the DB. * The document returned has no paths marked as modified initi
types/models.d.ts:394
↓ 9 callersMethodreplaceOne
Creates a `replaceOne` query: finds the first document that matches `filter` and replaces it with `replacement`.
types/models.d.ts:747
↓ 8 callersMethodcast
(val)
test/document.test.js:7933
↓ 8 callersMethoddistinct
Creates a `distinct` query: returns the distinct values of the given `field` that match `filter`.
types/models.d.ts:523
↓ 7 callersMethod$init
(key, value)
lib/types/map.js:32
↓ 7 callersMethodnext
(cb)
lib/cursor/ChangeStream.js:92
↓ 6 callersMethodaddError
* add message * @param {String} path * @param {String|Error} error * @api private
lib/error/validation.js:59
↓ 6 callersFunctionapplyTimestampsToChildren
(now, update, schema)
lib/helpers/update/applyTimestampsToChildren.js:12
↓ 6 callersMethodstartSession
* Starts a [MongoDB session](https://www.mongodb.com/docs/manual/release-notes/3.6/#client-sessions) * for benefits like causal consistency, [ret
types/session.d.ts:26
↓ 6 callersMethodwatch
Watches the underlying collection for changes using [MongoDB change streams](https://www.mongodb.com/docs/manual/changeStreams/).
types/models.d.ts:511
↓ 5 callersMethodestimatedDocumentCount
Creates a `estimatedDocumentCount` query: counts the number of documents in the collection.
types/models.d.ts:532
↓ 5 callersMethodexists
* Returns a document with its `_id` if at least one document exists in the database that matches * the given `filter`, and `null` otherwise.
types/models.d.ts:544
↓ 5 callersMethodfindByIdAndDelete
Creates a `findByIdAndDelete` query, filtering by the given `_id`.
types/models.d.ts:582
↓ 5 callersMethodfindOneAndRemove
Creates a `findOneAndRemove` query: atomically finds the given document and deletes it.
types/models.d.ts:675
↓ 5 callersFunctionhandleTimestampOption
(arg, prop)
lib/helpers/schema/handleTimestampOption.js:9
↓ 5 callersFunctionmodifiedPaths
(update, path, result, recursion = null)
lib/helpers/common.js:72
↓ 5 callersMethodset
* Overwrites native Map's `set()` function to support setters, `populate()`, * and change tracking. Note that Mongoose maps _only_ support strings
lib/types/map.js:81
↓ 4 callersFunction_checkManualPopulation
(arr, docs)
lib/types/array/methods/index.js:997
↓ 4 callersFunction_updateParentPopulated
* If this is a document array, each element may contain single * populated paths, so we need to modify the top-level document's * populated cache. S
lib/types/DocumentArray/methods/index.js:368
↓ 4 callersMethodbyName
(this: QueryWithHelpers<any, ITest, QueryHelpers>, name: string)
test/types/queries.test.ts:27
↓ 4 callersFunctioncb
()
test/index.test.js:560
↓ 4 callersMethodclear
* Overwrites native Map's `clear()` function to support change tracking. * * @api public * @method clear * @memberOf Map
lib/types/map.js:175
↓ 4 callersMethodcreateIndexes
* Similar to `ensureIndexes()`, except for it uses the [`createIndex`](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#creat
types/indexes.d.ts:17
↓ 4 callersMethodgetIndexes
Retrieves information about this collections indexes.
types/collection.d.ts:41
↓ 4 callersMethodlistIndexes
* Lists the indexes currently defined in MongoDB. This may or may not be * the same as the indexes defined in your schema depending on whether yo
types/indexes.d.ts:38
↓ 4 callersMethodopenUri
()
test/driver.test.js:30
↓ 4 callersMethodtoBSON
* Converts this map to a native JavaScript Map so the MongoDB driver can serialize it. * * @api public * @method toBSON * @memberOf Map
lib/types/map.js:208
↓ 3 callersMethod$toObject
()
lib/types/map.js:225
↓ 3 callersMethod_bindEvents
()
lib/cursor/ChangeStream.js:48
↓ 3 callersFunction_castMinMaxDistance
(self, val)
lib/schema/operators/geospatial.js:100
↓ 3 callersFunctionapplyTimestampsToUpdate
(now, createdAt, updatedAt, currentUpdate, options)
lib/helpers/update/applyTimestampsToUpdate.js:15
↓ 3 callersMethodbar
()
test/types/models.test.ts:30
↓ 3 callersMethodbulkSave
* Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than * sending multiple `save()` calls because with `bulkSave()` there
types/models.d.ts:241
↓ 3 callersFunctioncast$geometry
(val, self)
lib/schema/operators/geospatial.js:40
↓ 3 callersFunctiondefineKey
* Defines the accessor named prop on the incoming prototype. * @param {Object} options * @param {String} options.prop * @param {Boolean} options.su
lib/helpers/document/compile.js:68
↓ 3 callersFunctioneachAsync
()
test/types/queries.test.ts:184
↓ 3 callersMethodensureIndexes
* Sends `createIndex` commands to mongo for each index declared in the schema. * The `createIndex` commands are sent in series.
types/indexes.d.ts:30
↓ 3 callersFunctiongetVirtual
(schema, name)
lib/helpers/populate/getVirtual.js:9
↓ 3 callersFunctioninspectable
* Debug print helper * @param {Any} representation * @api private
lib/drivers/node-mongodb-native/collection.js:349
↓ 3 callersFunctionisLiteral
(val)
lib/helpers/query/cast$expr.js:282
↓ 3 callersFunctionisOperator
* Checks whether an object is likely a pipeline operator * * @param {Object} obj object to check * @return {Boolean} * @api private
lib/aggregate.js:1174
↓ 3 callersFunctionisPath
(val)
lib/helpers/query/cast$expr.js:278
↓ 3 callersFunctionmerge
(schema, baseSchema)
lib/helpers/model/discriminator.js:83
↓ 3 callersMethodstart
()
test/connection_server.js:17
↓ 3 callersFunctionstringifySemverNumber
* Stringify a semver number array * @param {number[]} arr The array to stringify * @param {boolean} dotX If "true", return "5.X" instead of "5.5.5"
scripts/website.js:214
↓ 3 callersFunctiontransform
(doc, ret)
test/document.test.js:817
↓ 3 callersMethodtranslateAliases
Translate any aliases fields/conditions so the final query or document object is pure
types/models.d.ts:520
↓ 2 callersFunction_assign
(model, vals, mod, assignmentOpts)
lib/model.js:4614
↓ 2 callersFunction_castArrayFilters
(query)
lib/query.js:2248
↓ 2 callersFunction_castExpression
(val, schema, strictQuery)
lib/helpers/query/cast$expr.js:78
next →1–100 of 1,018, ranked by callers