|
1 | 1 | # Exercises: Basic types |
2 | 2 |
|
3 | 3 | ## boolean |
4 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1d80e97570c2714a07e0">`equals`</Playground> (<Playground url="https://search-playground.mongodb.com/tools/code-playground/snapshots/669e6ab1d49ef6fad98118b4">fixed</Playground>) |
5 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1e53d0df60f0254e5d2b">`in`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c19c4e97570c2714a07dc">fixed</Playground>) |
6 | | - |
| 4 | + |
| 5 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1d80e97570c2714a07e0">`equals`</Playground> |
| 6 | +<details> |
| 7 | + <summary>Solution</summary> |
| 8 | + <div> |
| 9 | + ```js |
| 10 | + path: "in_stock" |
| 11 | + ``` |
| 12 | + |
| 13 | + <Playground url="https://search-playground.mongodb.com/tools/code-playground/snapshots/669e6ab1d49ef6fad98118b4">boolean `equals` fixed</Playground> |
| 14 | + </div> |
| 15 | +</details> |
| 16 | + |
| 17 | + |
| 18 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1e53d0df60f0254e5d2b">`in`</Playground> |
| 19 | +<details> |
| 20 | + <summary>Solution</summary> |
| 21 | + <div> |
| 22 | + ```js |
| 23 | + value: [true, false] |
| 24 | + ``` |
| 25 | + |
| 26 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c19c4e97570c2714a07dc">boolean `in` fixed</Playground> |
| 27 | + </div> |
| 28 | +</details> |
| 29 | + |
| 30 | + |
7 | 31 | ## date |
8 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1b0fe97570c2714a07de">`equals`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c20a4d0df60f0254e5d2d">fixed</Playground>) |
9 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1b5fd0df60f0254e5d27">`in`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c210ee97570c2714a07e2">fixed</Playground>) |
10 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c21c8d0df60f0254e5d2f">`range`</Playground> (<Playground url="https://search-playground.mongodb.com/tools/code-playground/snapshots/669e6b18d49ef6fad98118b6">fixed</Playground>) |
| 32 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1b0fe97570c2714a07de">`equals`</Playground> |
| 33 | +<details> |
| 34 | + <summary>Solution</summary> |
| 35 | + <div> |
| 36 | + ```js |
| 37 | + value: ISODate("2023-11-01T00:00:00.000Z") |
| 38 | + ``` |
| 39 | + |
| 40 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c20a4d0df60f0254e5d2d">date `equals` fixed</Playground> |
| 41 | + </div> |
| 42 | +</details> |
| 43 | + |
| 44 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c1b5fd0df60f0254e5d27">`in`</Playground> |
| 45 | +<details> |
| 46 | + <summary>Solution</summary> |
| 47 | + <div> |
| 48 | + ```js |
| 49 | + value: [ISODate("2024-02-01T00:00:00.000Z"), ISODate("2023-11-01T00:00:00.000Z"), ISODate("2007-12-25T00:00:00.000Z")] |
| 50 | + ``` |
| 51 | + |
| 52 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c210ee97570c2714a07e2">date `in` fixed</Playground> |
| 53 | + </div> |
| 54 | +</details> |
| 55 | + |
| 56 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c21c8d0df60f0254e5d2f">`range`</Playground> |
| 57 | +<details> |
| 58 | + <summary>Solution</summary> |
| 59 | + <div> |
| 60 | + ```js |
| 61 | + path: "published_date" |
| 62 | + ``` |
| 63 | + <Playground url="https://search-playground.mongodb.com/tools/code-playground/snapshots/669e6b18d49ef6fad98118b6">date `range` fixed</Playground> |
| 64 | + </div> |
| 65 | +</details> |
| 66 | + |
11 | 67 |
|
12 | 68 | ## number |
13 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c25abd0df60f0254e5d35">`equals`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c25e2d0df60f0254e5d37">fixed</Playground>) |
14 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c252ce97570c2714a07e6">`in`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c2569d0df60f0254e5d33">fixed</Playground>) |
15 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c2313d0df60f0254e5d31">`range`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c22bde97570c2714a07e4">fixed</Playground>) |
| 69 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c25abd0df60f0254e5d35">`equals`</Playground> |
| 70 | +<details> |
| 71 | + <summary>Solution</summary> |
| 72 | + <div> |
| 73 | + ```js |
| 74 | + path: "price" |
| 75 | + ``` |
| 76 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c25e2d0df60f0254e5d37">number `equals` fixed</Playground> |
| 77 | + </div> |
| 78 | +</details> |
| 79 | + |
| 80 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c252ce97570c2714a07e6">`in`</Playground> |
| 81 | +<details> |
| 82 | + <summary>Solution</summary> |
| 83 | + <div> |
| 84 | + ```js |
| 85 | + value: [19.99, 37.5] |
| 86 | + ``` |
| 87 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c2569d0df60f0254e5d33">number `in` fixed</Playground> |
| 88 | + </div> |
| 89 | +</details> |
| 90 | + |
| 91 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c2313d0df60f0254e5d31">`range`</Playground> (fix two issues, not just one!) |
| 92 | +<details> |
| 93 | + <summary>Solution</summary> |
| 94 | + <div> |
| 95 | + ```js |
| 96 | + range: { |
| 97 | + path: "price", |
| 98 | + gte: 15.00, |
| 99 | + lte: 25.00 |
| 100 | + } |
| 101 | + ``` |
| 102 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c22bde97570c2714a07e4">number `range` fixed</Playground> |
| 103 | + </div> |
| 104 | +</details> |
16 | 105 |
|
17 | 106 | ## ObjectId |
18 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c265dd0df60f0254e5d39">`equals`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67962d77aa132ffc76719f53">fixed</Playground>) |
19 | | - * <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c26d5d0df60f0254e5d3b">`in`</Playground> (<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c270cd0df60f0254e5d3d">fixed</Playground>) |
| 107 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c265dd0df60f0254e5d39">`equals`</Playground> |
| 108 | +<details> |
| 109 | + <summary>Solution</summary> |
| 110 | + <div> |
| 111 | + ```js |
| 112 | + value: ObjectId("5a9427648b0beebeb69589a1") |
| 113 | + ``` |
| 114 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/67962d77aa132ffc76719f53">ObjectId `equals` fixed</Playground> |
| 115 | + </div> |
| 116 | +</details> |
| 117 | + |
| 118 | +<Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c26d5d0df60f0254e5d3b">`in`</Playground> |
| 119 | +<details> |
| 120 | + <summary>Solution</summary> |
| 121 | + <div> |
| 122 | + ```js |
| 123 | + value: [ObjectId("ba94c7648b0beebeb69589a1"), ObjectId("5a9427648b0beebeb69589a1")] |
| 124 | + ``` |
| 125 | + <Playground url="https://search-playground.corp.mongodb.com/tools/code-sandbox/snapshots/679c270cd0df60f0254e5d3d">ObjectId `in` fixed</Playground> |
| 126 | + </div> |
| 127 | +</details> |
0 commit comments