MCPcopy Create free account

hub / github.com/Automattic/mongoose / functions

Functions1,533 in github.com/Automattic/mongoose

↓ 217 callersFunctionmodel
()
test/errors.validation.test.js:267
↓ 201 callersMethodcreate
Creates a new document or documents
types/models.d.ts:337
↓ 145 callersMethodfindOne
Finds one document.
types/models.d.ts:513
↓ 112 callersMethodget
* Overwrites native Map's `get()` function to support Mongoose getters. * * @api public * @method get * @memberOf Map
lib/types/map.js:57
↓ 104 callersMethodfind
Creates a `find` query: gets a list of documents that match `filter`.
types/models.d.ts:862
↓ 100 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:107
↓ 97 callersMethodclose
()
lib/cursor/changeStream.js:201
↓ 93 callersMethodtoObject
(options)
lib/types/map.js:249
↓ 75 callersFunctionstart
(ctx)
test/tracing.test.js:42
↓ 73 callersMethodtoString
* toString helper * TODO remove? This defaults to `${this.name}: ${this.message}` * @api private
lib/error/validator.js:41
↓ 62 callersMethodadd
* Add a dotted path, like `settings.$*` or `profile.firstName`, to the trie. * * @param {string} path
lib/helpers/pathTrie.js:44
↓ 55 callersMethodhas
* Overwrites native Map's `has()` function to support ObjectIds as keys. * * @api public * @method has * @memberOf Map
lib/types/map.js:77
↓ 55 callersMethodpopulate
Populates document references.
types/models.d.ts:746
↓ 54 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:462
↓ 52 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:372
↓ 52 callersMethodtest
(this: TestDoc)
test/types/loadclass.test.ts:166
↓ 48 callersMethoddiscriminator
Adds a discriminator type.
types/models.d.ts:424
↓ 44 callersMethodvalidate
Casts and validates the given object against this model's schema, returning the casted-and-validated copy of `obj`, passing the given `context` to cus
types/models.d.ts:775
↓ 41 callersMethodfindOneAndUpdate
Creates a `findOneAndUpdate` query: atomically find the first document that matches `filter` and apply `update`.
types/models.d.ts:1504
↓ 38 callersMethodinit
* This function is responsible for building [indexes](https://www.mongodb.com/docs/manual/indexes/), * unless [`autoIndex`](http://mongoosejs.com
types/models.d.ts:648
↓ 38 callersMethodupdateOne
Creates a `updateOne` query: updates the first document that matches `filter` with `update`.
types/models.d.ts:1736
↓ 35 callersMethodcast
(val, doc, init, prev, options)
lib/schema/union.js:34
↓ 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:34
↓ 34 callersMethodvalueOf
()
test/helpers/clone.test.js:234
↓ 32 callersFunctiondone
(err)
lib/model.js:1708
↓ 32 callersMethodinsertMany
Inserts one or more new documents as a single `insertMany` call to the MongoDB server.
types/models.d.ts:651
↓ 31 callersMethodtoJSON
()
lib/error/cast.js:33
↓ 29 callersMethodclone
()
lib/schema/union.js:124
↓ 27 callersMethodaggregate
(pipeline?: PipelineStage[], options?: AggregateOptions)
types/models.d.ts:251
↓ 27 callersMethodwhere
Creates a Query, applies the passed conditions, and returns the Query.
types/models.d.ts:1748
↓ 26 callersFunctionget
()
lib/model.js:4483
↓ 25 callersFunctionisBsonType
* Determines if `obj` has the given BSON type. * @api private
lib/helpers/isBsonType.js:8
↓ 24 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:400
↓ 23 callersMethodbulkWrite
* Sends multiple `insertOne`, `updateOne`, `updateMany`, `replaceOne`, * `deleteOne`, and/or `deleteMany` operations to the MongoDB server in one
types/models.d.ts:293
↓ 22 callersMethodcollection
()
test/driver.test.js:26
↓ 22 callersMethodcountDocuments
Creates a `countDocuments` query: counts the number of documents that match `filter`.
types/models.d.ts:313
↓ 21 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:633
↓ 20 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:1192
↓ 20 callersMethodinsertOne
* Shortcut for saving one document to the database. * `MyModel.insertOne(obj, options)` is almost equivalent to `new MyModel(obj).save(options)`.
types/models.d.ts:734
↓ 19 callersMethodon
(event, handler)
lib/cursor/changeStream.js:185
↓ 18 callersMethodapplySetters
(val, doc, init, prev, options)
lib/schema/union.js:62
↓ 17 callersMethodfindOneAndReplace
Creates a `findOneAndReplace` query: atomically finds the given document and replaces it with `replacement`.
types/models.d.ts:1330
↓ 16 callersFunctionfn
()
test/parallelLimit.test.js:17
↓ 15 callersMethodfindByIdAndUpdate
Creates a `findOneAndUpdate` query, filtering by the given `_id`.
types/models.d.ts:1080
↓ 15 callersMethodinspect
()
lib/types/map.js:295
↓ 15 callersMethodupdateMany
Creates a `updateMany` query: updates all documents that match `filter` with `update`.
types/models.d.ts:1724
↓ 14 callersFunctionbuildMiddlewareFilter
* Builds a filter for kareem's execPre/execPost based on middleware options. * * @param {object} options - Options object that may contain `middlewa
lib/helpers/buildMiddlewareFilter.js:18
↓ 14 callersMethoddistinct
Creates a `distinct` query: returns the distinct values of the given `field` that match `filter`.
types/models.d.ts:793
↓ 14 callersMethodnext
(cb)
lib/cursor/changeStream.js:119
↓ 14 callersMethodreplaceOne
Creates a `replaceOne` query: finds the first document that matches `filter` and replaces it with `replacement`.
types/models.d.ts:1702
↓ 13 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:350
↓ 13 callersMethoddelete
* Overwrites native Map's `delete()` function to support change tracking. * * @api public * @method delete * @memberOf Map
lib/types/map.js:228
↓ 13 callersFunctionnext
(cb)
test/helpers/cursor.eachAsync.test.js:15
↓ 10 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:539
↓ 10 callersMethodcast
(val)
test/document.test.js:8330
↓ 10 callersMethodonce
(event, handler)
lib/cursor/changeStream.js:193
↓ 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:49
↓ 9 callersFunction_updateSubdocIndexes
(arr)
lib/types/documentArray/methods/index.js:515
↓ 9 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:307
↓ 9 callersFunctioncb
()
test/index.test.js:683
↓ 9 callersMethodfindByIdAndDelete
Creates a `findByIdAndDelete` query, filtering by the given `_id`.
types/models.d.ts:998
↓ 8 callersMethodgetEmbeddedSchemaType
* Returns the embedded schema type (i.e. the `.$*` path) * * @api public
lib/schema/map.js:100
↓ 7 callersMethod$init
(key, value)
lib/types/map.js:35
↓ 7 callersMethodestimatedDocumentCount
Creates a `estimatedDocumentCount` query: counts the number of documents in the collection.
types/models.d.ts:827
↓ 7 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:840
↓ 7 callersMethodtoJSONSchema
* Returns this schema type's representation in a JSON schema. * * @param {object} [options] * @param {boolean} [options.useBsonType=false] If
lib/schema/union.js:138
↓ 6 callersMethodaddError
* add message * @param {string} path * @param {string|Error} error * @api private
lib/error/validation.js:53
↓ 6 callersMethoddoValidate
(value, scope, options)
lib/schema/union.js:98
↓ 6 callersFunctionhandleTimestampOption
(arg, prop)
lib/helpers/schema/handleTimestampOption.js:9
↓ 6 callersMethodopenUri
()
test/driver.test.js:30
↓ 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:781
↓ 5 callersMethodcastObject
(obj: AnyObject, options?: { ignoreCastErrors?: boolean })
types/models.d.ts:272
↓ 5 callersMethodcreateIndexes
* Similar to `ensureIndexes()`, except for it uses the [`createIndex`](https://mongodb.github.io/node-mongodb-native/7.0/classes/Collection.html#creat
types/indexes.d.ts:20
↓ 5 callersFunctionisOperator
* Checks whether an object is likely a pipeline operator * * @param {object} obj object to check * @return {boolean} * @api private
lib/aggregate.js:1241
↓ 5 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:41
↓ 5 callersMethodmyMethod
()
test/types/models.test.ts:268
↓ 5 callersMethodsetModel
(model)
lib/error/cast.js:78
↓ 4 callersFunction_checkManualPopulation
(arr, docs)
lib/types/array/methods/index.js:1124
↓ 4 callersFunctionapplyTimestampsToChildren
* Apply timestamps to any subdocuments * * @param {Schema} schema subdocument schema * @param {object} res subdocument * @param {object} [options]
lib/helpers/document/applyTimestamps.js:38
↓ 4 callersMethodbyName
(this: QueryWithHelpers<any, ITest, QueryHelpers>, name: string)
test/types/queries.test.ts:26
↓ 4 callersMethodclear
* Overwrites native Map's `clear()` function to support change tracking. * * @api public * @method clear * @memberOf Map
lib/types/map.js:212
↓ 4 callersFunctioncreateTracedChannel
(name)
lib/tracing.js:20
↓ 4 callersMethoddiffIndexes
* Does a dry-run of Model.syncIndexes(), meaning that * the result of this function would be the result of * Model.syncIndexes().
types/indexes.d.ts:27
↓ 4 callersMethodfindAndCount
Finds documents and counts the number of documents matching `filter`.
types/models.d.ts:976
↓ 4 callersMethodfindByName
(name: string)
test/types/plugin.test.ts:101
↓ 4 callersFunctionisLiteral
(val)
lib/helpers/query/cast$expr.js:301
↓ 4 callersFunctionscrollThreadToBottom
()
docs/js/ask-ai.js:308
↓ 3 callersMethod$toObject
()
lib/types/map.js:262
↓ 3 callersMethod_bindEvents
()
lib/cursor/changeStream.js:56
↓ 3 callersFunction_castExpression
(val, schema, strictQuery)
lib/helpers/query/cast$expr.js:83
↓ 3 callersFunction_castMinMaxDistance
(self, val)
lib/schema/operators/geospatial.js:100
↓ 3 callersFunction_setIsNew
(doc, val, hasOnlyPrimitiveValues)
lib/model.js:3363
↓ 3 callersFunctionapplyTimestampsToChildren
(now, update, schema)
lib/helpers/update/applyTimestampsToChildren.js:12
↓ 3 callersFunctionapplyTimestampsToUpdate
(now, createdAt, updatedAt, currentUpdate, options, upsert, isReplace)
lib/helpers/update/applyTimestampsToUpdate.js:16
↓ 3 callersMethodbar
()
test/types/models.test.ts:37
↓ 3 callersFunctioncast$geometry
(val, self)
lib/schema/operators/geospatial.js:40
↓ 3 callersFunctionclone
()
test/helpers/clone.test.js:180
↓ 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:69
↓ 3 callersMethoddoValidateSync
(value, scope, options)
lib/schema/union.js:112
next →1–100 of 1,533, ranked by callers