0

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.

2
  • Where is ctx being defined? Commented Mar 8, 2013 at 16:54
  • I didn't define ctx since pymongo works without me having to define it Commented Mar 8, 2013 at 17:39

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.