Skip to content

Commit

Permalink
feat(types): create new ProjectionType type for select(), find(),…
Browse files Browse the repository at this point in the history
… etc.

Fix #11437
  • Loading branch information
vkarpov15 committed Apr 5, 2022
1 parent df99c27 commit 499e532
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 60 deletions.
8 changes: 5 additions & 3 deletions test/types/queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ Test.find({ tags: { $in: ['test'] } }).exec();
// Implicit `$in`
Test.find({ name: ['Test1', 'Test2'] }).exec();

Test.find({ name: 'test' }, (err: Error, docs: ITest[]) => {
Test.find({ name: 'test' }, (err: Error | null, docs: ITest[]) => {
console.log(!!err, docs[0].age);
});

Test.findOne({ name: 'test' }, (err: Error, doc: ITest) => {
console.log(!!err, doc.age);
Test.findOne({ name: 'test' }, (err: Error | null, doc: ITest | null) => {
if (doc != null) {
console.log(!!err, doc.age);
}
});

Test.find({ name: { $gte: 'Test' } }, null, { collation: { locale: 'en-us' } }).exec().
Expand Down

0 comments on commit 499e532

Please sign in to comment.