From 3ae5f34a91e8db6b73b5daea0d378337337ca4a8 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 23 Jan 2024 06:29:31 -0500 Subject: Update mongodb.html.markdown (#4358) fixed in: -> $in: and added $nin: too --- mongodb.html.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mongodb.html.markdown') diff --git a/mongodb.html.markdown b/mongodb.html.markdown index 306f361c..eeb70265 100644 --- a/mongodb.html.markdown +++ b/mongodb.html.markdown @@ -264,8 +264,9 @@ db.engineers.find({ $lte: { age: 25 }}) db.engineers.find({ $eq: { age: 25 }}) db.engineers.find({ $ne: { age: 25 }}) -// Find all that match any element in the array -db.engineers.find({ age: ${ in: [ 20, 23, 24, 25 ]}}) +// Find all that match any element in the array, or not in the array +db.engineers.find({ age: { $in: [ 20, 23, 24, 25 ]}}) +db.engineers.find({ age: { $nin: [ 20, 23, 24, 25 ]}}) //////////////// Logical Operators /////////////////// -- cgit v1.2.3 From 873f136122f5b0f63b4d72d4c68a4bbb20e79419 Mon Sep 17 00:00:00 2001 From: nvmnghia Date: Tue, 30 Jan 2024 07:33:32 +0000 Subject: fix(mongodb): correct operator order (#4832) --- mongodb.html.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mongodb.html.markdown') diff --git a/mongodb.html.markdown b/mongodb.html.markdown index eeb70265..5633f3f9 100644 --- a/mongodb.html.markdown +++ b/mongodb.html.markdown @@ -252,17 +252,17 @@ db.engineers.deleteMany({ gender: 'Male' }) //////////////// Comparison Operators /////////////////// // Find all greater than or greater than equal to some condition -db.engineers.find({ $gt: { age: 25 }}) -db.engineers.find({ $gte: { age: 25 }}) +db.engineers.find({ age: { $gt: 25 }}) +db.engineers.find({ age: { $gte: 25 }}) // Find all less than or less than equal to some condition -db.engineers.find({ $lt: { age: 25 }}) -db.engineers.find({ $lte: { age: 25 }}) +db.engineers.find({ age: { $lt: 25 }}) +db.engineers.find({ age: { $lte: 25 }}) // Find all equal or not equal to // Note: the $eq operator is added implicitly in most queries -db.engineers.find({ $eq: { age: 25 }}) -db.engineers.find({ $ne: { age: 25 }}) +db.engineers.find({ age: { $eq: 25 }}) +db.engineers.find({ age: { $ne: 25 }}) // Find all that match any element in the array, or not in the array db.engineers.find({ age: { $in: [ 20, 23, 24, 25 ]}}) -- cgit v1.2.3 From 665c28c90e6c051f43d1fa3e3c2fe7543f3ae742 Mon Sep 17 00:00:00 2001 From: Adrien LUDWIG <42720099+Adrien-LUDWIG@users.noreply.github.com> Date: Sun, 25 Feb 2024 22:48:09 +0100 Subject: [MongoDB] Fix comment: wrong method (#4779) --- mongodb.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mongodb.html.markdown') diff --git a/mongodb.html.markdown b/mongodb.html.markdown index 5633f3f9..f4e7d709 100644 --- a/mongodb.html.markdown +++ b/mongodb.html.markdown @@ -228,7 +228,7 @@ db.engineers.update({ name: 'Foo Baz' }, ) /////////////////////// Delete ///////////////////////// -// Queries are in the form of db.collectionName.find() +// Queries are in the form of db.collectionName.delete() // Delete first document matching query, always returns deletedCount db.engineers.deleteOne({ name: 'Foo Baz' }) -- cgit v1.2.3