Wrapper for mongodb-collection class
pip install moncoll
from moncoll import Moncoll
settings = {"user": "testuser", "password": "testpass", "dbname": "db_test"}
coll_name = "test_collection"
coll = Moncoll(settings, coll_name)
coll.insert_one({"_id": 123})
coll.insert_one({"_id": 456})
res = coll.find()
print(res) # => [{"_id": 123}, {"_id": 456}]
coll.drop()
collection – Collection level operations — PyMongo documentation
Please refer to here. But there are some differences.
- "find" and "aggregate" return a list instead of a cursor
MIT © atu4403