From d7f7fed26ca88c0ac496c2b4103f8032354ca2b5 Mon Sep 17 00:00:00 2001 From: tactonbishop Date: Thu, 11 Aug 2022 14:00:04 +0100 Subject: [PATCH] Last Sync: 2022-08-11 14:00:04 --- .../MongoDB/Querying_a_collection_with_Mongoose.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Databases/MongoDB/Querying_a_collection_with_Mongoose.md b/Databases/MongoDB/Querying_a_collection_with_Mongoose.md index 2396460..a280c09 100644 --- a/Databases/MongoDB/Querying_a_collection_with_Mongoose.md +++ b/Databases/MongoDB/Querying_a_collection_with_Mongoose.md @@ -117,8 +117,16 @@ The following comparison operators are available in MongoDB: | `in` | In | | `nin` | Not in | -We can employ these comparators within a `.find` filter. For example let's imagine that our `courses` instances have a property of `price`. To filter prices $>= 10 \And \And <= 20$: +We can employ these comparators within a `.find` filter. For example let's imagine that our `courses` instances have a property of `price`. + +To filter course prices that are greater than or equal to 10 and less than or equal to 29: ```js Course.find(({price: {$gte: 10, $lte: 20} })) +``` + +To filter course prices that are either 10, 15 or 20: + +```js +Course.find(({price: {$in: [10, 15, 20] } })) ``` \ No newline at end of file