listCollections can't filter on collection options when using nameOnly

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 4.0.0
    • Component/s: Storage
    • Storage Execution
    • ALL
    • Hide
      MongoDB Enterprise > db.createCollection("cappitycapcap", {capped:true, size:100})
      { "ok" : 1 }
      MongoDB Enterprise > db.runCommand({listCollections:1, filter:{"options.capped":true}, nameOnly: true})
      {
              "cursor" : {
                      "id" : NumberLong(0),
                      "ns" : "lcbug.$cmd.listCollections",
                      "firstBatch" : [ ]
              },
              "ok" : 1
      }
      MongoDB Enterprise > db.runCommand({listCollections:1, filter:{"options.capped":true}})
      {
              "cursor" : {
                      "id" : NumberLong(0),
                      "ns" : "lcbug.$cmd.listCollections",
                      "firstBatch" : [
                              {
                                      "name" : "cappitycapcap",
                                      "type" : "collection",
                                      "options" : {
                                              "capped" : true,
                                              "size" : 256
                                      },
                                      "info" : {
                                              "readOnly" : false,
                                              "uuid" : UUID("abf81435-62d6-4247-85c6-6bc4bc9bfff2")
                                      },
                                      "idIndex" : {
                                              "v" : 2,
                                              "key" : {
                                                      "_id" : 1
                                              },
                                              "name" : "_id_",
                                              "ns" : "lcbug.cappitycapcap"
                                      }
                              }
                      ]
              },
              "ok" : 1
      }
      
      Show
      MongoDB Enterprise > db.createCollection("cappitycapcap", {capped:true, size:100}) { "ok" : 1 } MongoDB Enterprise > db.runCommand({listCollections:1, filter:{"options.capped":true}, nameOnly: true}) { "cursor" : { "id" : NumberLong(0), "ns" : "lcbug.$cmd.listCollections", "firstBatch" : [ ] }, "ok" : 1 } MongoDB Enterprise > db.runCommand({listCollections:1, filter:{"options.capped":true}}) { "cursor" : { "id" : NumberLong(0), "ns" : "lcbug.$cmd.listCollections", "firstBatch" : [ { "name" : "cappitycapcap", "type" : "collection", "options" : { "capped" : true, "size" : 256 }, "info" : { "readOnly" : false, "uuid" : UUID("abf81435-62d6-4247-85c6-6bc4bc9bfff2") }, "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "lcbug.cappitycapcap" } } ] }, "ok" : 1 }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When using listCollections with the nameOnly option and a filter, it looks like the filter is applied after retrieving only name information.

      The documentation isn't clear that this is what should occur and the behavior could be surprising to users.

      Another possible improvement would be to have the command fail if nameOnly is true and the filter contains any keys other than name.

              Assignee:
              [DO NOT USE] Backlog - Storage Execution Team
              Reporter:
              David Golden
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: