1
这是可能做到这一点的短片在Python,我得到的错误,Pymongo子文档更新
>> collection.insert({u'name.first': u'John'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/someone/env/local/lib/python2.7/site-packages/pymongo/collection.py", line 415, in insert
self.uuid_subtype, client)
bson.errors.InvalidDocument: key 'name.first' must not contain '.'
编辑:感谢shx2指着我出来,那插入应该更新。而在网络上的一些冲浪后,我找到了答案是,
>> collection.update({_id: <some_id_or_index>}, {$set: {<python_dict_object_to_be_updated>}}