Python MongoDBLesson 129Free preview
MongoDB Query
This lesson is part of Python · All levels
Summary
This lesson covers further queries in MongoDB, from comparison operators like $gt and $gte, the $in operators for list values, to text matching with $regex. You'll also learn the projection to select which field to display. The combination of filters and projections makes data reading more efficient.
Key points
- Comparison operator: $gt is greater, $gte is greater than, $lt, $lte, and $ne.
- $in comparing the value against the candidate list, or $in combining some conditions.
- The projection limits the returned field, _id always follows unless turned off.
- The field of a constellation is written with a dot, for example {"alamat.city": "Jakarta"}.
- Documents that do not have a value of a field are considered to be unsuitable for the field filter.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.