1)在添加新文档之前,我希望MongoModel使用此字段(code2)值检查文档是否存在
from pymodm import connect, fields, MongoModel, EmbeddedMongoModel
class LibInspiration(MongoModel):
code1 = fields.IntegerField(required=True, primary_key=True)
code2 = fields.CharField()
timestamp = fields.TimestampField(required=True)
2)一旦被询问,仍然是如何使pymodm自动添加时间戳