Skip to content

A Simple Chaining Wrapper for PyMongo Aggregated Queries

License

Notifications You must be signed in to change notification settings

roeesheelo/tatum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tatum - A Simple PyMongo Chaining Wrapper

Usage:

Example 1 - find by field's value and project that field. limit to 10 results:

query = Chaining().select('<field_name>')
.find(<field_name>, <field_value>)
.limit(10)

for docs in query.all():

iterate docs

Example 2 - find by field's value, project 2 fields and sort by field:

query = Chaining().select('<field_name>')
.select('<field_name2>')
.find('<field_name>', '<field_value>')
.sort(<field_name>, )

count = query.count()

=> {"count": }

Example 3 - find all. group by 2 fields and project these fields:

query = Chaining().select('<field_name>')
.select('<field_name2>')
.group(<field_name>)
.group(<field_name2>) \

for docs in query.all(): for doc in docs['items']: # perform actions on doc

About

A Simple Chaining Wrapper for PyMongo Aggregated Queries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages