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
157
+
expectError(Test.find({},{name: 3}));// Only 0 and 1 are allowed
158
+
expectError(Test.find({},{name: true,age: false,endDate: true,tags: 1}));// Exclusion in a inclusion projection is not allowed
159
+
expectError(Test.find({},{name: true,age: false,endDate: true}));// Inclusion in a exclusion projection is not allowed
160
+
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
161
+
expectError(Test.find({},{tags: {something: 1}}));// array of strings or numbers should only be allowed to be a boolean or 1 and 0
162
+
Test.find({},{name: true,age: true,endDate: true,tags: 1,child: {name: true},docs: {myId: true,id: true}});// This should be allowed
163
+
Test.find({},{name: 1,age: 1,endDate: 1,tags: 1,child: {name: 1},docs: {myId: 1,id: 1}});// This should be allowed
164
+
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
165
+
Test.find({},{name: 0,age: 0,endDate: 0,tags: 0,child: 0,docs: 0});// This should be allowed
166
+
Test.find({},{name: 0,age: 0,endDate: 0,tags: 0,child: {name: 0},docs: {myId: 0,id: 0}});// This should be allowed
167
+
Test.find({},{name: 1,age: 1,_id: 0});// This should be allowed since _id is an exception
168
+
Test.find({},{someOtherField: 1});// This should be allowed since it's not a field in the schema
169
+
expectError(Test.find({},{name: {$slice: 1}}));// $slice should only be allowed on arrays
170
+
Test.find({},{tags: {$slice: 1}});// $slice should be allowed on arrays
171
+
Test.find({},{tags: {$slice: [1,2]}});// $slice with the format of [ <number to skip>, <number to return> ] should also be allowed on arrays
172
+
expectError(Test.find({},{age: {$elemMatch: {}}}));// $elemMatch should not be allowed on non arrays
173
+
Test.find({},{docs: {$elemMatch: {id: 'aa'}}});// $elemMatch should be allowed on arrays
174
+
expectError(Test.find({},{tags: {$slice: 1,$elemMatch: {}}}));// $elemMatch and $slice should not be allowed together
175
+
Test.find({},{age: 1,tags: {$slice: 5}});// $slice should be allowed in inclusion projection
176
+
Test.find({},{age: 0,tags: {$slice: 5}});// $slice should be allowed in exclusion projection
177
+
Test.find({},{age: 1,tags: {$elemMatch: {}}});// $elemMatch should be allowed in inclusion projection
178
+
Test.find({},{age: 0,tags: {$elemMatch: {}}});// $elemMatch should be allowed in exclusion projection
179
+
expectError(Test.find({},{'docs.id': 11}));// Dot notation should be allowed and does not accept any
180
+
expectError(Test.find({},{docs: {id: '1'}}));// Dot notation should be able to use a combination with objects
181
+
Test.find({},{docs: {id: false}});// Dot notation should be allowed with valid values - should correctly handle arrays
182
+
Test.find({},{docs: {id: true}});// Dot notation should be allowed with valid values - should correctly handle arrays
183
+
Test.find({docs: {$elemMatch: {id: 1}}},{'docs.$': 1});// $ projection should be allowed
184
+
Test.find({},{child: 1});// Dot notation should be able to use a combination with objects
185
+
// Test.find({}, { 'docs.profiles': { name: 1 }}); // 3 levels deep not supported
186
+
expectError(Test.find({},{'docs.profiles': {name: 'aa'}}));// should support a combination of dot notation and objects
0 commit comments