【发布时间】:2016-09-12 07:59:15
【问题描述】:
我的代码中没有“2dshpere”。 我的课很简单
class DbBatch(Document):
start_time = DateTimeField(required = True)
duration_seconds = IntField()
run_on_port = ListField(StringField())
batch_name = StringField(required = True)
batch_parameters = EmbeddedDocumentListField(DevicePortParameter)
statistics = EmbeddedDocumentListField(Statistics)
我只是在做
reg0_batch0 = DbBatch()
reg0_batch0.batch_name = 'reg0_batch2'
reg0_batch0.run_on_port = ['0']
我在保存文档时出错 - 为什么????这个简单的列表中没有 2d 球体或任何有趣的东西
# Saving to DB
reg0_batch0.save()
# output
......
File "C:\Python27\lib\site-packages\mongoengine\document.py", line 398, in save
raise OperationError(message % unicode(err))
OperationError: Could not save document
(Can't extract geo keys: { _id: ObjectId('57d64f926151394b5c740fea'),
start_time: new Date(1473673632148), run_on_port: [ 0 ],
batch_name: "reg0_batch2", batch_parameters: [], statistics: [] }
Point must only contain numeric elements)
并且在清除 ListField 时我没有收到任何错误
reg0_batch0.run_on_port = []
reg0_batch0.save()
# good response - saved into DB
Out[16]: <DbBatch: DbBatch object>
有什么想法吗?
顺便说一句 - 与 ListField(IntField()) 的结果相同
【问题讨论】:
标签: mongodb mongoengine