Я только начинаю изучать Mongodb и pymongo. Я намеревался расширить новый список до значения списка документа, я пытался находку(), но ничего не выйдет .. После моя структура данных:Как получить значение из документа Mongodb?
{ "_id" : ObjectId("58784108b0925e52ec4c478b"), "ip" : "61.228.93.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-11T20:29:51" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c478c"), "ip" : "61.231.1.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-15T15:54:17" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c478d"), "ip" : "220.135.220.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-11T08:42:41" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c478e"), "ip" : "111.248.98.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-15T06:21:08" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c478f"), "ip" : "111.243.254.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-11T00:54:30" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c4790"), "ip" : "111.248.102.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-14T04:10:31" } ], "updated_time" : "2017-01-13T10:52:56" }
{ "_id" : ObjectId("58784108b0925e52ec4c4791"), "ip" : "36.229.236.0", "history" : [ { "aging_type" : "static", "from" : "dragonresearchgroup.org", "threat" : "Scanners", "updated_time" : "2016-05-13T22:51:34" } ], "updated_time" : "2017-01-13T10:52:56" }
Предположим, что я хочу, чтобы получить «историю» значение чье значение «ip» равно «61.228.93.0», а затем добавьте [{'aging_type':static,'updated_time':2017-1-13T10:55:22}]
к этому значению списка, затем обновите это значение «история» с расширенным списком, что я должен делать? Я попытался db.collection.find({"ip":'ip'})['history']
и db.collection.find({"ip":'ip'},{'history':1})
, но это кажется не поможет .. я был бы признателен, если кто-то рода может помочь мне с этой проблемой
попробовать это 'db.collection.find ({IP:«61.228.93.0»})', чтобы получить значения которых ф is '61.228.93.0' –