[SERVER-38173] No array filter found for identifier <identifier> in path <path> Created: 16/Nov/18  Updated: 30/Nov/18  Resolved: 30/Nov/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.6.9
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Denis Olenev Assignee: Danny Hatcher (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Виділення_226.png    
Operating System: ALL
Steps To Reproduce:

Create collection

db.students2.insertMany([{
  "_id" : 1,
  "grades" : [
    { "grade" : 80, "mean" : 75, "std" : 6 },
    { "grade" : 85, "mean" : 90, "std" : 4 },
    { "grade" : 85, "mean" : 85, "std" : 6 }
  ]
},
{
  "_id" : 2,
  "grades" : [
    { "grade" : 90, "mean" : 75, "std" : 6 },
    { "grade" : 87, "mean" : 90, "std" : 3 },
    { "grade" : 85, "mean" : 85, "std" : 4 }
  ]
}])

 

 

Execute query for Robo 3T 

db.students2.update(
 { },
 { $set: { "grades.$[elem].mean" : 100 } },
 {
   multi: true,
   arrayFilters: [ { "elem.grade": { $gte: 85 } } ]
 }
)

 

Result

No array filter found for identifier 'elem' in path 'grades.$[elem].mean'

Save same query to file students2.js and execute in terminal shell

mongo test students2.js 

Result

MongoDB shell version v3.6.9
connecting to: mongodb://127.0.0.1:27017/test
Implicit session: session { "id" : UUID("ca4a94a6-75ce-45d0-a3d8-38c5b2a4aaa4") }

and only after shell executing

db.getCollection('students2').find({}) gives

 

/* 1 */
{
 "_id" : 1.0,
 "grades" : [ 
 {
 "grade" : 80.0,
 "mean" : 75.0,
 "std" : 6.0
 }, 
 {
 "grade" : 85.0,
 "mean" : 100.0,
 "std" : 4.0
 }, 
 {
 "grade" : 85.0,
 "mean" : 100.0,
 "std" : 6.0
 }
 ]
}
/* 2 */
{
 "_id" : 2.0,
 "grades" : [ 
 {
 "grade" : 90.0,
 "mean" : 100.0,
 "std" : 6.0
 }, 
 {
 "grade" : 87.0,
 "mean" : 100.0,
 "std" : 3.0
 }, 
 {
 "grade" : 85.0,
 "mean" : 100.0,
 "std" : 4.0
 }
 ]
}

 

 

Participants:

 Description   

I am trying to create a query that updates arrayed subdocuments, but I keep getting an error:

"No array filter found for identifier '<identifier>' in path '<path>'"

Error is getting in Robo 3T 1.2.1.
When execute update from shell in terminal everything is ok.

It is reproducible using the examples from the documentation. 

 

mongo --version
MongoDB shell version v3.6.9
git version: 167861a164723168adfaaa866f310cb94010428f
OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017
allocator: tcmalloc
modules: none
build environment:
 distmod: ubuntu1604
 distarch: x86_64
 target_arch: x86_64



 Comments   
Comment by Danny Hatcher (Inactive) [ 16/Nov/18 ]

Hello Denis,

You mention that the shell performs as expected, can you please confirm? Unfortunately, Robo3T is not a MongoDB product so we are unable to help with bugs within it. I recommend that you reach out to the people that develop the tool at robomongo as they would be best to help you.

Thank you,

Danny

Generated at Thu Feb 08 04:48:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.