I don't know exactly if it is in Flask-MongoAlchemy or in MongoAlchemy, but the filtering for mongo_id does not work correctly.
To get a single object referenced by it's id, one would use:
SomeDocument.get_or_404( 'mongoidstring')
This query does always return 'None' (doesn't exists a test for this?)
Internally the get method is mapped to .filter( { 'mongo_id': 'mongoidstring'} ).first()
This does somehow not work, not even with pure MongoAlchemy.
What actually works is .filter( SomeDocument.mongo_id == 'mongoidstring' )
I'm using MongoAlchemy 0.8 and Flask-MongoAlchemy 0.3
Both installed with easy_install.
I don't know exactly if it is in Flask-MongoAlchemy or in MongoAlchemy, but the filtering for mongo_id does not work correctly. To get a single object referenced by it's id, one would use:
This query does always return 'None' (doesn't exists a test for this?) Internally the get method is mapped to .filter( { 'mongo_id': 'mongoidstring'} ).first()
This does somehow not work, not even with pure MongoAlchemy. What actually works is .filter( SomeDocument.mongo_id == 'mongoidstring' )
I'm using MongoAlchemy 0.8 and Flask-MongoAlchemy 0.3 Both installed with easy_install.