我正在尝试将bjson结构转换为棉花糖库中的模式。在
以下是棉花糖模式:
class GeneSchema(Schema):
"""description of class"""
id_entrez = fields.Integer(required = True, error_messages={'required': "The 'id_entrez' field is requeired."})
symbol = fields.String()
@validates('id_entrez')
def validate_id_entrez(self, data):
if data <= 0:
raise ValidationError("The 'id_entrez' field must be greater than zero.")
下面是bjson将转换为架构:
^{pr2}$请注意,bjson将“\u id”作为ObjectId-“$oid”。这是因为使用mongodb查询的结果。在
请问,有人知道为什么不把bjson模式转换成棉花糖模式?在
谢谢大家!在
您仍然可以使用模式来解析MongoDB输出,只需忽略额外的“_id”字段。另一方面,如果您确实想解析这个“_id”,只需在模式中添加额外的非必需字段。在
相关问题 更多 >
编程相关推荐