Skip to content

Commit e80cff1

Browse files
committed
progress
1 parent eb449c4 commit e80cff1

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

lib/document.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ Document.prototype.$__init = function(doc, opts) {
694694
init(this, doc, this._doc, opts);
695695

696696
markArraySubdocsPopulated(this, opts.populated);
697-
698697
this.$emit('init', this);
699698
this.constructor.emit('init', this);
700699

@@ -703,7 +702,6 @@ Document.prototype.$__init = function(doc, opts) {
703702
null;
704703

705704
applyDefaults(this, this.$__.selected, this.$__.exclude, hasIncludedChildren, false, this.$__.skipDefaults);
706-
707705
return this;
708706
};
709707

@@ -746,7 +744,6 @@ function init(self, obj, doc, opts, prefix) {
746744
}
747745
path = prefix + i;
748746
schemaType = docSchema.path(path);
749-
750747
// Should still work if not a model-level discriminator, but should not be
751748
// necessary. This is *only* to catch the case where we queried using the
752749
// base model and the discriminated model has a projection

lib/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3830,6 +3830,7 @@ Model.buildBulkWriteOperations = function buildBulkWriteOperations(documents, op
38303830
* @param {Object|String|String[]} [projection] optional projection containing which fields should be selected for this document
38313831
* @param {Object} [options] optional options
38323832
* @param {Boolean} [options.setters=false] if true, apply schema setters when hydrating
3833+
* @param {Boolean} [options.hydratedPopulatedDocs=false] if true, populates the docs if passing pre-populated data
38333834
* @return {Document} document instance
38343835
* @api public
38353836
*/
@@ -3843,7 +3844,6 @@ Model.hydrate = function(obj, projection, options) {
38433844
}
38443845
obj = applyProjection(obj, projection);
38453846
}
3846-
38473847
const document = require('./queryHelpers').createModel(this, obj, projection);
38483848
document.$init(obj, options);
38493849
return document;

test/model.hydrate.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ describe('model', function() {
115115
const company = { _id: new mongoose.Types.ObjectId(), name: 'Booster', users: [users[0]] };
116116

117117
const C = Company.hydrate(company, null, { hydratedPopulatedDocs: true });
118+
console.log('what is C', C);
118119
assert.equal(C.users[0].name, 'Val');
119120
});
120121
});

0 commit comments

Comments
 (0)