'RoboMongo can't use array filters?

Following on from "How to update collection and increment hours for ISO date".

It seem that RoboMongo can't execute a query with an array filter:

RoboMongo error

This same query if find when executed through the Mongo shell though:

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

Looking at the logging in the Mongo server, it looks like the query is passed over correctly, but still fails:

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

The logs from the shell are different:

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

I can't see anything that would imply that something is wrong though (other than the assertion failure of course).

  • What's causing RoboMongo to fail where Mongo shell succeeds?
  • Is there anything in these logs that tells me what's wrong?


Solution 1:[1]

Checked 4 years latter and it is working now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nimrod serok