diff --git a/lib/document.js b/lib/document.js index dc8df23830f..188b554f296 100644 --- a/lib/document.js +++ b/lib/document.js @@ -1258,7 +1258,8 @@ Document.prototype.isSelected = function isSelected(path) { if (cur === '_id') { continue; } - if (this.$__.selected[cur] && this.$__.selected[cur].$meta) { + var projection = this.$__.selected[cur]; + if (projection && (projection.$meta || projection.$slice)) { continue; } inclusive = !!this.$__.selected[cur]; diff --git a/test/model.discriminator.querying.test.js b/test/model.discriminator.querying.test.js index 2cb3fe7cf55..69e4732a563 100644 --- a/test/model.discriminator.querying.test.js +++ b/test/model.discriminator.querying.test.js @@ -1023,13 +1023,13 @@ describe('model', function() { var Discriminator = Base.discriminator('gh4991_A1', discriminatorSchema); var obj = { propA: 'Hi', propB: 'test', array: ['a', 'b'] }; - Discriminator.create(obj, function(error, doc) { + Discriminator.create(obj, function(error) { assert.ifError(error); Base.find().slice('array', 1).exec(function(error, docs) { assert.equal(docs.length, 1); assert.equal(docs[0].propA, 'Hi'); done(); - }) + }); }); });