summaryrefslogtreecommitdiffhomepage
path: root/mongodb.html.markdown
diff options
context:
space:
mode:
authornvmnghia <nvmnghia@gmail.com>2024-01-30 07:33:32 +0000
committerGitHub <noreply@github.com>2024-01-30 08:33:32 +0100
commit873f136122f5b0f63b4d72d4c68a4bbb20e79419 (patch)
treef6d8edebf4963f2d2c5240e15475ab037d0054f2 /mongodb.html.markdown
parent8498d0254a139e037eecac2acc389785a74a56c7 (diff)
fix(mongodb): correct operator order (#4832)
Diffstat (limited to 'mongodb.html.markdown')
-rw-r--r--mongodb.html.markdown12
1 files changed, 6 insertions, 6 deletions
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 ]}})