我正在尝试更新mongodb数据集,如下所示。
db.tms_upload_files.update( {"_id" : ObjectId("589cb708ac229ee469c84e52")}, { $set: { "flag": "U" } });
我收到了一条成功消息,但在运行查询查询时,我发现它没有更新。
日志如下
2017-02-20T15:34:38.840+0100 I COMMAND [conn44347] command TS_NEW.$cmd command: update { update: "tms_upload_files", ordered: false, updates: [ { q: { filename: "00_25_7E_03_97_A0#170210023013" }, u: { $set: { flag: "P" } } } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:55 locks:{ Global: { acquireCount: { r: 15, w: 15 } }, Database: { acquireCount: { w: 15 } }, Collection: { acquireCount: { w: 15 } }, Metadata: { acquireCount: { W: 1 } } } protocol:op_query 1ms
2017-02-20T15:34:38.842+0100 D COMMAND [conn44347] run command TS_NEW.$cmd { find: "tms_upload_files", filter: { filename: "00_25_7E_03_99_58#170209093758" }, limit: 1, singleBatch: true }
2017-02-20T15:34:38.842+0100 D QUERY [conn44347] Only one plan is available; it will be run but will not be cached. query: { filename: "00_25_7E_03_99_58#170209093758" } sort: {} projection: {} limit: 1, planSummary: COLLSCAN
2017-02-20T15:34:38.843+0100 I COMMAND [conn44347] command TS_NEW.tms_upload_files command: find { find: "tms_upload_files", filter: { filename: "00_25_7E_03_99_58#170209093758" }, limit: 1, singleBatch: true } planSummary: COLLSCAN keysExamined:0 docsExamined:1710 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:13 nreturned:1 reslen:673 locks:{ Global: { acquireCount: { r: 28 } }, Database: { acquireCount: { r: 14 } }, Collection: { acquireCount: { r: 14 } } } protocol:op_query 1ms
2017-02-20T15:34:38.844+0100 D COMMAND [conn44347] run command TS_NEW.$cmd { update: "tms_upload_files", ordered: false, updates: [ { q: { filename: "00_25_7E_03_99_58#170209093758" }, u: { $set: { flag: "I" } } } ] }
2017-02-20T15:34:38.844+0100 D QUERY [conn44347] Only one plan is available; it will be run but will not be cached. query: { filename: "00_25_7E_03_99_58#170209093758" } sort: {} projection: {}, planSummary: COLLSCAN
2017-02-20T15:34:38.845+0100 I WRITE [conn44347] update TS_NEW.tms_upload_files query: { filename: "00_25_7E_03_99_58#170209093758" } update: { $set: { flag: "I" } } keysExamined:0 docsExamined:1710 nMatched:1 nModified:1 keyUpdates:0 writeConflicts:0 numYields:13 locks:{ Global: { acquireCount: { r: 14, w: 14 } }, Database: { acquireCount: { w: 14 } }, Collection: { acquireCount: { w: 14 } } } 1ms
2017-02-20T15:34:38.845+0100 I COMMAND [conn44347] command TS_NEW.$cmd command: update { update: "tms_upload_files", ordered: false, updates: [ { q: { filename: "00_25_7E_03_99_58#170209093758" }, u: { $set: { flag: "I" } } } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:55 locks:{ Global: { acquireCount: { r: 15, w: 15 } }, Database: { acquireCount: { w: 15 } }, Collection: { acquireCount: { w: 15 } }, Metadata: { acquireCount: { W: 1 } } } protocol:op_query 1ms
2017-02-20T15:34:39.569+0100 D COMMAND [conn44347] run command TS_NEW.$cmd { find: "tms_upload_files", filter: { filename: "00_25_7E_03_99_58#170209093758" }, limit: 1, singleBatch: true }
2017-02-20T15:34:39.569+0100 D QUERY [conn44347] Only one plan is available; it will be run but will not be cached. query: { filename: "00_25_7E_03_99_58#170209093758" } sort: {} projection: {} limit: 1, planSummary: COLLSCAN
2017-02-20T15:34:39.572+0100 I COMMAND [conn44347] command TS_NEW.tms_upload_files command: find { find: "tms_upload_files", filter: { filename: "00_25_7E_03_99_58#170209093758" }, limit: 1, singleBatch: true } planSummary: COLLSCAN keysExamined:0 docsExamined:1710 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:13 nreturned:1 reslen:673 locks:{ Global: { acquireCount: { r: 28 } }, Database: { acquireCount: { r: 14 } }, Collection: { acquireCount: { r: 14 } } } protocol:op_query 2ms
2017-02-20T15:34:39.572+0100 D COMMAND [conn44347] run command TS_NEW.$cmd { update: "tms_upload_files", ordered: false, updates: [ { q: { filename: "00_25_7E_03_99_58#170209093758" }, u: { $set: { flag: "P" } } } ] }
2017-02-20T15:34:39.573+0100 D QUERY [conn44347] Only one plan is available; it will be run but will not be cached. query: { filename: "00_25_7E_03_99_58#170209093758" } sort: {} projection: {}, planSummary: COLLSCAN
2017-02-20T15:34:39.575+0100 I WRITE [conn44347] update TS_NEW.tms_upload_files query: { filename: "00_25_7E_03_99_58#170209093758" } update: { $set: { flag: "P" } } keysExamined:0 docsExamined:1710 nMatched:1 nModified:1 keyUpdates:0 writeConflicts:0 numYields:13 locks:{ Global: { acquireCount: { r: 14, w: 14 } }, Database: { acquireCount: { w: 14 } }, Collection: { acquireCount: { w: 14 } } } 2ms
2017-02-20T15:34:39.575+0100 I COMMAND [conn44347] command TS_NEW.$cmd command: update { update: "tms_upload_files", ordered: false, updates: [ { q: { filename: "00_25_7E_03_99_58#170209093758" }, u: { $set: { flag: "P" } } } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:55 locks:{ Global: { acquireCount: { r: 15, w: 15 } }, Database: { acquireCount: { w: 15 } }, Collection: { acquireCount: { w: 15 } }, Metadata: { acquireCount: { W: 1 } } } protocol:op_query 2ms
2017-02-20T15:34:39.577+0100 D COMMAND [conn44347] run command TS_NEW.$cmd { find: "tms_upload_files", filter: { filename: "00_25_7E_03_98_AF#170210033144" }, limit: 1, singleBatch: true }
请帮我理解日志
答案 0 :(得分:0)
db.tms_upload_files.updateOne( {"_id" : ObjectId("589cb708ac229ee469c84e52")}, { $set: { "flag": "U" } });
完美运作