You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expectError(Test.find({},{name: 'ss'}));// Only 0 and 1 are allowed
168
+
expectError(Test.find({},{name: 3}));// Only 0 and 1 are allowed
169
+
expectError(Test.find({},{name: true,age: false,endDate: true,tags: 1}));// Exclusion in a inclusion projection is not allowed
170
+
expectError(Test.find({},{name: true,age: false,endDate: true}));// Inclusion in a exclusion projection is not allowed
171
+
expectError(Test.find({},{name: false,age: false,tags: false,child: {name: false},docs: {myId: false,id: true}}));// Inclusion in a exclusion projection is not allowed in nested objects and arrays
172
+
expectError(Test.find({},{tags: {something: 1}}));// array of strings or numbers should only be allowed to be a boolean or 1 and 0
173
+
Test.find({},{name: true,age: true,endDate: true,tags: 1,child: {name: true},docs: {myId: true,id: true}});// This should be allowed
174
+
Test.find({},{name: 1,age: 1,endDate: 1,tags: 1,child: {name: 1},docs: {myId: 1,id: 1}});// This should be allowed
175
+
Test.find({},{_id: 0,name: 1,age: 1,endDate: 1,tags: 1,child: 1,docs: 1});// _id is an exception and should be allowed to be excluded
176
+
Test.find({},{name: 0,age: 0,endDate: 0,tags: 0,child: 0,docs: 0});// This should be allowed
177
+
Test.find({},{name: 0,age: 0,endDate: 0,tags: 0,child: {name: 0},docs: {myId: 0,id: 0}});// This should be allowed
178
+
Test.find({},{name: 1,age: 1,_id: 0});// This should be allowed since _id is an exception
179
+
Test.find({},{someOtherField: 1});// This should be allowed since it's not a field in the schema
180
+
expectError(Test.find({},{name: {$slice: 1}}));// $slice should only be allowed on arrays
181
+
Test.find({},{tags: {$slice: 1}});// $slice should be allowed on arrays
182
+
Test.find({},{tags: {$slice: [1,2]}});// $slice with the format of [ <number to skip>, <number to return> ] should also be allowed on arrays
183
+
expectError(Test.find({},{age: {$elemMatch: {}}}));// $elemMatch should not be allowed on non arrays
184
+
Test.find({},{docs: {$elemMatch: {id: 'aa'}}});// $elemMatch should be allowed on arrays
185
+
expectError(Test.find({},{tags: {$slice: 1,$elemMatch: {}}}));// $elemMatch and $slice should not be allowed together
186
+
Test.find({},{age: 1,tags: {$slice: 5}});// $slice should be allowed in inclusion projection
187
+
Test.find({},{age: 0,tags: {$slice: 5}});// $slice should be allowed in exclusion projection
188
+
Test.find({},{age: 1,tags: {$elemMatch: {}}});// $elemMatch should be allowed in inclusion projection
189
+
Test.find({},{age: 0,tags: {$elemMatch: {}}});// $elemMatch should be allowed in exclusion projection
190
+
expectError(Test.find({},{'docs.id': 11}));// Dot notation should be allowed and does not accept any
191
+
expectError(Test.find({},{docs: {id: '1'}}));// Dot notation should be able to use a combination with objects
192
+
Test.find({},{docs: {id: false}});// Dot notation should be allowed with valid values - should correctly handle arrays
193
+
Test.find({},{docs: {id: true}});// Dot notation should be allowed with valid values - should correctly handle arrays
194
+
Test.find({docs: {$elemMatch: {id: 1}}},{'docs.$': 1});// $ projection should be allowed
195
+
Test.find({},{child: 1});// Dot notation should be able to use a combination with objects
196
+
// Test.find({}, { 'docs.profiles': { name: 1 }}); // 3 levels deep not supported
197
+
expectError(Test.find({},{'docs.profiles': {name: 'aa'}}));// should support a combination of dot notation and objects
0 commit comments