Skip to content

Commit

Permalink
docs: clean up some API issues re: #12024
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 8, 2022
1 parent d80a2ee commit 14fd916
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/document.js
Expand Up @@ -2167,7 +2167,7 @@ Document.prototype.$isDeleted = function(val) {
* doc.isDirectModified('documents.0.title') // true
* doc.isDirectModified('documents') // false
*
* @param {String|Array<String>} path
* @param {String|String[]} path
* @return {Boolean}
* @api public
*/
Expand Down Expand Up @@ -2223,7 +2223,7 @@ Document.prototype.isInit = function(path) {
* doc.isSelected('name') // true
* doc.isSelected('age') // false
*
* @param {String|Array<String>} path
* @param {String|String[]} path
* @return {Boolean}
* @api public
*/
Expand Down Expand Up @@ -3110,7 +3110,7 @@ function _checkImmutableSubpaths(subdoc, schematype, priorVal) {
/**
* Checks if a path is invalid
*
* @param {String|Array<String>} path the field to check
* @param {String|String[]} path the field to check
* @method $isValid
* @memberOf Document
* @instance
Expand Down Expand Up @@ -4342,7 +4342,7 @@ Document.prototype.$populated = Document.prototype.populated;
* doc.$assertPopulated('other path'); // throws an error
*
*
* @param {String|Array<String>} path
* @param {String|String[]} path
* @return {Document} this
* @memberOf Document
* @method $assertPopulated
Expand Down
28 changes: 14 additions & 14 deletions lib/model.js
Expand Up @@ -2129,7 +2129,7 @@ Model.deleteMany = function deleteMany(conditions, options, callback) {
* await MyModel.find({ name: /john/i }, null, { skip: 10 }).exec();
*
* @param {Object|ObjectId} filter
* @param {Object|String|Array<String>} [projection] optional fields to return, see [`Query.prototype.select()`](https://mongoosejs.com/docs/api.html#query_Query-select)
* @param {Object|String|String[]} [projection] optional fields to return, see [`Query.prototype.select()`](https://mongoosejs.com/docs/api.html#query_Query-select)
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {Function} [callback]
* @return {Query}
Expand Down Expand Up @@ -2192,7 +2192,7 @@ Model.find = function find(conditions, projection, options, callback) {
* await Adventure.findById(id, 'name length').exec();
*
* @param {Any} id value of `_id` to query by
* @param {Object|String|Array<String>} [projection] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [projection] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {Function} [callback]
* @return {Query}
Expand Down Expand Up @@ -2235,7 +2235,7 @@ Model.findById = function findById(id, projection, options, callback) {
* await Adventure.findOne({ country: 'Croatia' }, 'name length').exec();
*
* @param {Object} [conditions]
* @param {Object|String|Array<String>} [projection] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [projection] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {Function} [callback]
* @return {Query}
Expand Down Expand Up @@ -2533,7 +2533,7 @@ Model.$where = function $where() {
* @param {Boolean} [options.timestamps=null] If set to `false` and [schema-level timestamps](/docs/guide.html#timestamps) are enabled, skip timestamps for this update. Note that this allows you to overwrite timestamps. Does nothing if schema-level timestamps are not set.
* @param {Boolean} [options.overwrite=false] By default, if you don't include any [update operators](https://docs.mongodb.com/manual/reference/operator/update/) in `update`, Mongoose will wrap `update` in `$set` for you. This prevents you from accidentally overwriting the document. This option tells Mongoose to skip adding `$set`. An alternative to this would be using [Model.findOneAndReplace(conditions, update, options, callback)](https://mongoosejs.com/docs/api/model.html#model_Model.findOneAndReplace).
* @param {Boolean} [options.upsert=false] if true, and no documents found, insert a new document
* @param {Object|String|Array<String>} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Function} [callback]
* @return {Query}
* @see Tutorial /docs/tutorials/findoneandupdate.html
Expand Down Expand Up @@ -2749,7 +2749,7 @@ Model.findByIdAndUpdate = function(id, update, options, callback) {
* @param {Object} conditions
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
* @param {Object|String|Array<String>} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
* @param {Function} [callback]
* @return {Query}
Expand Down Expand Up @@ -2855,7 +2855,7 @@ Model.findByIdAndDelete = function(id, options, callback) {
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
* @param {Boolean} [options.timestamps=null] If set to `false` and [schema-level timestamps](/docs/guide.html#timestamps) are enabled, skip timestamps for this update. Note that this allows you to overwrite timestamps. Does nothing if schema-level timestamps are not set.
* @param {Object|String|Array<String>} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Function} [callback]
* @return {Query}
* @api public
Expand Down Expand Up @@ -2942,7 +2942,7 @@ Model.findOneAndReplace = function(filter, replacement, options, callback) {
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
* @param {Object|String|Array<String>} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Function} [callback]
* @return {Query}
* @see mongodb https://www.mongodb.org/display/DOCS/findAndModify+Command
Expand Down Expand Up @@ -3008,7 +3008,7 @@ Model.findOneAndRemove = function(conditions, options, callback) {
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api.html#query_Query-setOptions)
* @param {Boolean|String} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
* @param {ClientSession} [options.session=null] The session associated with this query. See [transactions docs](/docs/transactions.html).
* @param {Object|String|Array<String>} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Object|String|String[]} [options.projection=null] optional fields to return, see [`Query.prototype.select()`](#query_Query-select)
* @param {Function} [callback]
* @return {Query}
* @see Model.findOneAndRemove #model_Model.findOneAndRemove
Expand Down Expand Up @@ -3288,11 +3288,11 @@ Model.startSession = function() {
*
* @param {Array|Object|*} doc(s)
* @param {Object} [options] see the [mongodb driver options](https://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#insertMany)
* @param {Boolean} [options.ordered = true] if true, will fail fast on the first error encountered. If false, will insert all the documents it can and report errors later. An `insertMany()` with `ordered = false` is called an "unordered" `insertMany()`.
* @param {Boolean} [options.rawResult = false] if false, the returned promise resolves to the documents that passed mongoose document validation. If `true`, will return the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpCallback) with a `mongoose` property that contains `validationErrors` if this is an unordered `insertMany`.
* @param {Boolean} [options.lean = false] if `true`, skips hydrating and validating the documents. This option is useful if you need the extra performance, but Mongoose won't validate the documents before inserting.
* @param {Number} [options.limit = null] this limits the number of documents being processed (validation/casting) by mongoose in parallel, this does **NOT** send the documents in batches to MongoDB. Use this option if you're processing a large number of documents and your app is running out of memory.
* @param {String|Object|Array} [options.populate = null] populates the result documents. This option is a no-op if `rawResult` is set.
* @param {Boolean} [options.ordered=true] if true, will fail fast on the first error encountered. If false, will insert all the documents it can and report errors later. An `insertMany()` with `ordered = false` is called an "unordered" `insertMany()`.
* @param {Boolean} [options.rawResult=false] if false, the returned promise resolves to the documents that passed mongoose document validation. If `true`, will return the [raw result from the MongoDB driver](https://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpCallback) with a `mongoose` property that contains `validationErrors` if this is an unordered `insertMany`.
* @param {Boolean} [options.lean=false] if `true`, skips hydrating and validating the documents. This option is useful if you need the extra performance, but Mongoose won't validate the documents before inserting.
* @param {Number} [options.limit=null] this limits the number of documents being processed (validation/casting) by mongoose in parallel, this does **NOT** send the documents in batches to MongoDB. Use this option if you're processing a large number of documents and your app is running out of memory.
* @param {String|Object|Array} [options.populate=null] populates the result documents. This option is a no-op if `rawResult` is set.
* @param {Function} [callback] callback
* @return {Promise} resolving to the raw result from the MongoDB driver if `options.rawResult` was `true`, or the documents that passed validation, otherwise
* @api public
Expand Down Expand Up @@ -3765,7 +3765,7 @@ Model.buildBulkWriteOperations = function buildBulkWriteOperations(documents, op
* const mongooseCandy = Candy.hydrate({ _id: '54108337212ffb6d459f854c', type: 'jelly bean' });
*
* @param {Object} obj
* @param {Object|String|Array<String>} [projection] optional projection containing which fields should be selected for this document
* @param {Object|String|String[]} [projection] optional projection containing which fields should be selected for this document
* @return {Document} document instance
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/query.js
Expand Up @@ -1069,7 +1069,7 @@ Query.prototype.projection = function(arg) {
* @method select
* @memberOf Query
* @instance
* @param {Object|String|Array<String>} arg
* @param {Object|String|String[]} arg
* @return {Query} this
* @see SchemaType
* @api public
Expand Down Expand Up @@ -5038,7 +5038,7 @@ function castQuery(query) {
* a response for each query has also been returned, the results are passed to
* the callback.
*
* @param {Object|String|Array<String>} path either the path(s) to populate or an object specifying all parameters
* @param {Object|String|String[]} path either the path(s) to populate or an object specifying all parameters
* @param {Object|String} [select] Field selection for the population query
* @param {Model} [model] The model you wish to use for population. If not specified, populate will look up the model by the name in the Schema's `ref` field.
* @param {Object} [match] Conditions for the population query
Expand Down

0 comments on commit 14fd916

Please sign in to comment.