Reputation: 10926
I'm trying to create an index with a flask-mongokit connection:
db = MongoKit(app)
db.mydatabase.users.create_index("email", unique=True)
But it throws this error at me:
...
host=ctx.app.config.get('MONGODB_HOST'),
AttributeError: 'NoneType' object has no attribute 'app'
If I use Pymongo directly instead:
conn = MongoClient()
conn.mydatabase.users.create_index("email", unique=True)
Everithing works fine!
The problem is that I don't want to manage a pymongo's connection but instead use the one created by the mongokit extension.
Upvotes: 0
Views: 774
Reputation: 10926
I found the solution, it seems that mongokit doesn't support index creation since version 7.x, they really should remove index creation from the official documentation.
https://github.com/namlook/mongokit/issues/98
Upvotes: 1