Skip to content

Commit

Permalink
docs: document return types for .discriminator()
Browse files Browse the repository at this point in the history
Fix #8287
  • Loading branch information
vkarpov15 committed Nov 3, 2019
1 parent 4c090c5 commit 2694cbd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/model.js
Expand Up @@ -1067,6 +1067,7 @@ Model.exists = function exists(filter, options, callback) {
* @param {String} name discriminator model name
* @param {Schema} schema discriminator model schema
* @param {String} [value] the string stored in the `discriminatorKey` property. If not specified, Mongoose uses the `name` parameter.
* @return {Model} The newly created discriminator model
* @api public
*/

Expand Down Expand Up @@ -3411,7 +3412,7 @@ Model.bulkWrite = function(ops, options, callback) {
* var mongooseCandy = Candy.hydrate({ _id: '54108337212ffb6d459f854c', type: 'jelly bean' });
*
* @param {Object} obj
* @return {Model} document instance
* @return {Document} document instance
* @api public
*/

Expand Down
2 changes: 1 addition & 1 deletion lib/queryhelpers.js
Expand Up @@ -107,7 +107,7 @@ exports.getDiscriminatorByValue = getDiscriminatorByValue;
* @param {Object} doc
* @param {Object} fields
*
* @return {Model}
* @return {Document}
*/
exports.createModel = function createModel(model, doc, fields, userProvidedFields) {
model.hooks.execPreSync('createModel', doc);
Expand Down
1 change: 1 addition & 0 deletions lib/schema/SingleNestedPath.js
Expand Up @@ -280,6 +280,7 @@ SingleNestedPath.prototype.doValidateSync = function(value, scope, options) {
* @param {String} name
* @param {Schema} schema fields to add to the schema for instances of this sub-class
* @param {String} [value] the string stored in the `discriminatorKey` property. If not specified, Mongoose uses the `name` parameter.
* @return {Function} the constructor Mongoose will use for creating instances of this discriminator model
* @see discriminators /docs/discriminators.html
* @api public
*/
Expand Down
1 change: 1 addition & 0 deletions lib/schema/documentarray.js
Expand Up @@ -147,6 +147,7 @@ function _createConstructor(schema, options, baseClass) {
* @param {Schema} schema fields to add to the schema for instances of this sub-class
* @param {String} [value] the string stored in the `discriminatorKey` property. If not specified, Mongoose uses the `name` parameter.
* @see discriminators /docs/discriminators.html
* @return {Function} the constructor Mongoose will use for creating instances of this discriminator model
* @api public
*/

Expand Down

0 comments on commit 2694cbd

Please sign in to comment.