Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我无法让 MongoEngine 接受特定的 ID。似乎绝对决心使用(并且只使用)ObjectIds。在这种情况下,我完全能够生成自己的 ID,谢谢。
ObjectId
我怎样才能让 MongoEngine 玩得很好?
我设法通过在类中添加以下内容来解决这个问题:
id = mongoengine.StringField(required=True, primary_key=True)
不确定这是否是“正确”的做事方式,所以暂时不回答这个问题。