Skip to content

Commit

Permalink
docs(populate): remove implicit Model.populate() example
Browse files Browse the repository at this point in the history
Re: #4843
  • Loading branch information
vkarpov15 committed Jan 1, 2017
1 parent 62c8b08 commit 22552c5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2526,8 +2526,8 @@ Model.geoSearch = function(conditions, options, callback) {
*
* User.populate(user, opts, function (err, user) {
* console.log(user);
* })
* })
* });
* });
*
* // populates an array of objects
* User.find(match, function (err, users) {
Expand All @@ -2540,6 +2540,11 @@ Model.geoSearch = function(conditions, options, callback) {
* // imagine a Weapon model exists with two saved documents:
* // { _id: 389, name: 'whip' }
* // { _id: 8921, name: 'boomerang' }
* // and this schema:
* // new Schema({
* // name: String,
* // weapon: { type: ObjectId, ref: 'Weapon' }
* // });
*
* var user = { name: 'Indiana Jones', weapon: 389 }
* Weapon.populate(user, { path: 'weapon', model: 'Weapon' }, function (err, user) {
Expand All @@ -2554,10 +2559,10 @@ Model.geoSearch = function(conditions, options, callback) {
* console.log('%s uses a %s', users.name, user.weapon.name)
* // Indiana Jones uses a whip
* // Batman uses a boomerang
* })
* })
* });
* });
* // Note that we didn't need to specify the Weapon model because
* // we were already using it's populate() method.
* // it is in the schema's ref
*
* @param {Document|Array} docs Either a single document or array of documents to populate.
* @param {Object} options A hash of key/val (path, options) used for population.
Expand Down

0 comments on commit 22552c5

Please sign in to comment.