[SERVER-9121] Error on invalid $pull: "{$pull: {flags : {$each : [1,2,3]}}}" Created: 25/Mar/13  Updated: 11/Jul/16  Resolved: 18/Sep/13

Status: Closed
Project: Core Server
Component/s: Querying, Write Ops
Affects Version/s: None
Fix Version/s: 2.5.2

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-6399 Refactor update() code Closed
is related to SERVER-9116 $pull operation does not work with $each Closed
Operating System: ALL
Participants:

 Description   

This should generate an error as it is not valid for storage and could be a simple user mistake. Also, when you use it a query filter it errors out.

> db.a.find({r:{$each:1}})
error: { "$err" : "invalid operator: $each", "code" : 10068 }
> db.a.update({}, {$pull:{r:{$each:1}}})

I suspect that many things will error out on the query side but not when used with $pull/updates.



 Comments   
Comment by Scott Hernandez (Inactive) [ 18/Sep/13 ]

Fixed with new update modifier framework:

> db.a.update({}, {$pull:{r:{$each:1}}})
unknown top level operator: $each

Generated at Thu Feb 08 03:19:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.