Skip to content

Commit 107b838

Browse files
committed
fix(discriminator): don't treat $meta as defining projection when querying
Fix #5859
1 parent 7c355b0 commit 107b838

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/queryhelpers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
var get = require('lodash.get');
7+
var isDefiningProjection = require('./services/projection/isDefiningProjection');
78
var utils = require('./utils');
89

910
/*!
@@ -90,7 +91,8 @@ exports.applyPaths = function applyPaths(fields, schema) {
9091
continue;
9192
}
9293
field = fields[keys[ki]];
93-
if (typeof field === 'object' && field && field.$slice) {
94+
// Skip `$meta` and `$slice`
95+
if (!isDefiningProjection(field)) {
9496
continue;
9597
}
9698
exclude = field === 0;

0 commit comments

Comments
 (0)