[SERVER-12994] Invalid queries accepted by delete command for collection that doesn't exist Created: 03/Mar/14  Updated: 06/Dec/22  Resolved: 13/May/18

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.6.0-rc0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Mathias Stearn Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-12993 Insert write command creates db and c... Closed
Assigned Teams:
Query
Operating System: ALL
Participants:

 Description   

> db.exists.insert({})
WriteResult({ "nInserted" : 1 })
> db.exists.runCommand('delete', {deletes: [{q:{$invalid: true}, limit:0}]})
{
        "ok" : 1,
        "n" : 0,
        "writeErrors" : [
                {
                        "index" : 0,
                        "code" : 17218,
                        "errmsg" : "Can't canonicalize query { $invalid: true }"
                }
        ]
}
> db.doesnt_exist.runCommand('delete', {deletes: [{q:{$invalid: true}, limit:0}]})
{ "ok" : 1, "n" : 0 }



 Comments   
Comment by Asya Kamsky [ 13/May/18 ]

Works as described in 3.6 (probably as part of update rewrite).

 

Comment by Daniel Pasette (Inactive) [ 03/Mar/14 ]

this seems wrong, but it's a side effect of failing fast before doing any work. And checking that the ns exists is one of the first things the server does so we miss this further operation validation.

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