开发者

MongoEngine specifying an ID

I'm having trouble getting MongoEngine to accept specific 开发者_如何学编程IDs. It seems absolutely determined to use (and only use) ObjectIds. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜