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>}}