나는 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})
하지만 누군가가 어떤 IP에 의한 문서의 이력 값 검색하려면이 문제
이'db.collection.find 시도 ({ "61.228.93.0"IP}) '61.228.93.0' –