MongoEngine Tutorial
Selected Reading
- MongoEngine - Discussion
- MongoEngine - Useful Resources
- MongoEngine - Quick Guide
- MongoEngine - Extensions
- MongoEngine - Text Search
- MongoEngine - Signals
- MongoEngine - GridFS
- MongoEngine - Javascript
- MongoEngine - Atomic Updates
- MongoEngine - Document Inheritance
- MongoEngine - Advanced Queries
- MongoEngine - Aggregation
- MongoEngine - Indexes
- MongoEngine - Custom Query Sets
- MongoEngine - Sorting
- MongoEngine - QuerySet Methods
- MongoEngine - Query Operators
- MongoEngine - Filters
- MongoEngine - Querying Database
- MongoEngine - Add/Delete Document
- MongoEngine - Fields
- MongoEngine - Dynamic Schema
- MongoEngine - Document Class
- MongoEngine - Connecting to MongoDB Database
- MongoEngine - Installation
- MongoEngine - Object Document Mapper
- MongoEngine - MongoDB Compass
- MongoEngine - MongoDB
- MongoEngine - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
MongoEngine - Filters
MongoEngine - Filters
The objects attribute is a QuerySet manager. It creates and returns a QuerySet when accessed. A query can be subjected to filter with the help of field names as keyword arguments. For example, from above products collection, to print details of document with name of product as ‘TV’, we use Name as keyword argument.
for product in products.objects(Name= TV ): print ( ID: ,product.ProductID, Name: ,product.Name, Price: ,product.price)
You can use filter method of QuerySet object to apply filter to query. Following code snippet also returns product details with name=’TV’.
qset=products.objects for product in qset.filter(Name= TV ): print ( ID: ,product.ProductID, Name: ,product.Name, Price: ,product.price)Advertisements