Top "Pymongo" questions

PyMongo is the official Python driver for MongoDB created and maintained by MongoDB, Inc.

In MongoDB's pymongo, how do I do a count()?

for post in db.datasets.find({"test_set":"abc"}).sort("abc",pymongo.DESCENDING).skip((page-1)*num).limit(num): This is …

mongodb count pymongo database
Pymongo, query on list field, and/or

I have a collection with some documents like: { _id: 5, vals: [100, 1100, 1500] }, { _id: 10, vals: [1100, 1700] } How can I query for documents that have, …

python mongodb pymongo
pymongo.errors.CursorNotFound: cursor id '...' not valid at server

I am trying to fetch some ids that exist in a mongo database with the following code: client = MongoClient('xx.…

python mongodb pymongo
pymongo : delete records elegantly

Here is my code to delete a bunch of records using pymongo ids = [] with MongoClient(MONGODB_HOST) as connection: db = …

python mongodb pymongo
How to check in PyMongo if collection exists and if exists empty (remove all from collection)?

How to check in PyMongo if collection exists and if exists empty (remove all from collection)? I have tried like …

python mongodb pymongo
How to get the object id in PyMongo after an insert?

I'm doing a simple insert into Mongo... db.notes.insert({ title: "title", details: "note details"}) After the note document is …

mongodb insert pymongo
How do you check if the client for a MongoDB instance is valid?

In particular, I am currently trying to check if a connection to a client is valid using the following function: …

python mongodb pymongo
object is not JSON serializable

I'm having some trouble with Mongodb and Python (Flask). I have this api.py file, and I want all requests …

python json mongodb flask pymongo
How to make pymongo's find() return a list?

Pymongo returns a cursor with it I am able to iterate over the results and append their documents to a …

pymongo
PyMongo -- cursor iteration

I've recently started testing MongoDB via shell and via PyMongo. I've noticed that returning a cursor and trying to iterate …

python mongodb pymongo