RoboMongo не может использовать фильтры массива?

В продолжение " Как обновить часы сбора и приращения для даты ISO".

Кажется, что RoboMongo не может выполнить запрос с фильтром массива:

Ошибка RoboMongo

Этот же запрос, если найти, когда выполняется через оболочку Mongo, хотя:

> db.collection.update({
...     "results.score": {
...         "$exists": true
...     }
... }, {
...     "$mul": {
...         "results.$[result].score": 10
...     }
... }, {
...     "arrayFilters": [{
...         "result.score": {
...             "$exists": true
...         }
...     }],
...     "multi": true
... })
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

Глядя на журналирование на сервере Mongo, похоже, что запрос прошел правильно, но все равно не удается:

D COMMAND  [conn4] run command test.$cmd { update: "collection", updates: [ { q: { results.score: { $exists: true } }, u: { $mul: { results.$[result].score: 10.0 } }, multi: true, upsert: false } ], ordered: true, $db: "test" }
D -        [conn4] User Assertion: 2:No array filter found for identifier 'result' in path 'results.$[result].score' src\mongo\db\update\update_driver.cpp 132
D WRITE    [conn4] Caught Assertion in update: BadValue: No array filter found for identifier 'result' in path 'results.$[result].score'
I WRITE    [conn4] update test.collection appName: "MongoDB Shell" command: { q: { results.score: { $exists: true } }, u: { $mul: { results.$[result].score: 10.0 } }, multi: true, upsert: false } exception: No array filter found for identifier 'result' in path 'results.$[result].score' code:BadValue numYields:0 locks:{} 4ms
D REPL     [conn4] Waiting for write concern. OpTime: { ts: Timestamp(0, 0), t: -1 }, write concern: { w: 1, wtimeout: 0 }
I COMMAND  [conn4] command test.$cmd appName: "MongoDB Shell" command: update { update: "collection", updates: [ { q: { results.score: { $exists: true } }, u: { $mul: { results.$[result].score: 10.0 } }, multi: true, upsert: false } ], ordered: true, $db: "test" } numYields:0 reslen:183 locks:{} protocol:op_command 7ms
D COMMAND  [conn4] run command test.$cmd { getlasterror: 1.0, w: 1.0, $readPreference: { mode: "secondaryPreferred" }, $db: "test" }
I COMMAND  [conn4] command test.$cmd appName: "MongoDB Shell" command: getLastError { getlasterror: 1.0, w: 1.0, $readPreference: { mode: "secondaryPreferred" }, $db: "test" } numYields:0 reslen:169 locks:{} protocol:op_command 0ms

Логи из оболочки разные:

D COMMAND  [conn8] run command test.$cmd { update: "collection", ordered: true, $db: "test" }
D STORAGE  [conn8] NamespaceUUIDCache: registered namespace test.collection with UUID a5f7f2ef-a7e3-4189-a9c4-29fdb5a18db9
D QUERY    [conn8] Only one plan is available; it will be run but will not be cached. query: { results.score: { $exists: true } } sort: {} projection: {}, planSummary: COLLSCAN
D STORAGE  [conn8] WT begin_transaction for snapshot id 367
D STORAGE  [conn8] WT commit_transaction for snapshot id 367
D STORAGE  [conn8] WT begin_transaction for snapshot id 368
D STORAGE  [conn8] WT rollback_transaction for snapshot id 368
I WRITE    [conn8] update test.collection appName: "MongoDB Shell" command: { q: { results.score: { $exists: true } }, u: { $mul: { results.$[result].score: 10.0 } }, arrayFilters: [ { result.score: { $exists: true } } ], multi: true, upsert: false } planSummary: COLLSCAN keysExamined:0 docsExamined:1 nMatched:1 nModified:1 numYields:0 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { w: 1 } }, Collection: { acquireCount: { w: 1 } } } 3ms
D REPL     [conn8] Waiting for write concern. OpTime: { ts: Timestamp(0, 0), t: -1 }, write concern: { w: 1, wtimeout: 0 }
I COMMAND  [conn8] command test.$cmd appName: "MongoDB Shell" command: update { update: "collection", ordered: true, $db: "test" } numYields:0 reslen:44 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { w: 1 } }, Collection: { acquireCount: { w: 1 } } } protocol:op_msg 4ms
D COMMAND  [conn8] run command test.$cmd { isMaster: 1.0, forShell: 1.0, $db: "test" }
D NETWORK  [conn8] Starting server-side compression negotiation
D NETWORK  [conn8] Compression negotiation not requested by client
I COMMAND  [conn8] command test.$cmd appName: "MongoDB Shell" command: isMaster { isMaster: 1.0, forShell: 1.0, $db: "test" } numYields:0 reslen:208 locks:{} protocol:op_msg 1ms

Я не вижу ничего, что указывало бы на то, что что-то не так (кроме ошибки подтверждения, конечно).

  • Что приводит к сбою RoboMongo в случае успеха оболочки Mongo?
  • Есть ли в этих журналах что-нибудь, что говорит мне, что не так?

1 ответ

Проверено 4 года спустя, и сейчас он работает.

Другие вопросы по тегам