MongoEngine specifying an ID
I'm having trouble getting MongoEngine to accept specific 开发者_如何学编程IDs. It seems absolutely determined to use (and only use) ObjectId
s. I'm more than able to generate my own IDs in this instance, thanks.
How can I get MongoEngine to play nice?
I managed to solve this by adding the following to the class:
id = mongoengine.StringField(required=True, primary_key=True)
Not sure if this is the "proper" way of doing things, so ill leave this unanswered for a bit.
精彩评论