54👍
✅
I’ve ran into something similar, for me the problem was this line:
from pymongo.objectid import ObjectId
The call seems to work in versions of PyMongo < 2.2
In pymongo 2.2 the call to import objectid is:
from bson.objectid import ObjectId
👤Vlad
3👍
Looks like they’re already aware (see this pull request), but no one’s created a pull request against the develop branch yet. You could try fixing that and submit a new pull request.
- Django – inline – Search for existing record instead of adding a new one
- Django REST Framework: define fields in nested object?
- Django + Emacs (as TextMate replacement)
2👍
I tried to install bson with pip directly. Uninstall, and install pymongo instead and the error didnt reappear.
- System date formatting not using django locale
- Django NameError: name 'views' is not defined
- Django: model has two ManyToMany relations through intermediate model
1👍
I’m on Python3 (in 2017) and found that the following works:
from pymongo import MongoClient
from bson import ObjectId
0👍
for me installing pymongo solved my issue:
pip3 install pymongo
source: https://kb.objectrocket.com/mongo-db/how-to-install-pymongo-and-connect-to-mongodb-in-python-363
👤john
- Pydev not recognizing python installation with django
- Variable not found. Declare it as envvar or define a default value
- Django: duplicates when filtering on many to many field
- Secure static media access in a Django site
- Django-tables2 set of columns
Source:stackexchange.com