Skip to content
Advertisement

Tag: mongodb

Why is PyMongo 3 giving ServerSelectionTimeoutError?

I’m using: Python 3.4.2 PyMongo 3.0.2 mongolab running mongod 2.6.9 uWSGI 2.0.10 CherryPy 3.7.0 nginx 1.6.2 uWSGI start params: I setup my MongoClient ONE time: I try and save a JSON dict to MongoDB: It works via a unit test that executes the same code path to mongodb. However when I execute via CherryPy and uWSGI using an HTTP POST,

Setting up MongoDB + Django

I am new to Mongo DB and Django. I’ve been trying to use Mongo DB as my primary Database for Django. I’ve installed MongoDB and Django-nonrel as per the following link: Django – MongoDB setup The version of django-nonrel, i am using is 1.7. Clone link to it: pip install git+https://github.com/django-nonrel/django@nonrel-1.7 After following all steps, my settings.py in the django

TypeError: ObjectId(”) is not JSON serializable

My response back from MongoDB after querying an aggregated function on document using Python, It returns valid response and i can print it but can not return it. Error: Print: But When i try to return: It is RESTfull call: db is well connected and collection is there too and I got back valid expected result but when i try

Removing _id element from Pymongo results

I’m attempting to create a web service using MongoDB and Flask (using the pymongo driver). A query to the database returns documents with the “_id” field included, of course. I don’t want to send this to the client, so how do I remove it? Here’s a Flask route: This returns: I thought it was a dictionary and I could just

Map Reduce on timestamps

Mongodb Database: How can I Map-Reduce or aggregate on the above data to generate an output as: I am trying to write some code but its difficult to average on unsorted dates. Are there any built in functions averaging on time to do this? Answer You could do min/max on the dates like described here for numbers and just add

Advertisement