Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-53541

Support DBRefs in wildcard indexes

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.2
    • Component/s: Index Maintenance
    • None
    • Query Execution
    • Query 2021-01-25, Query Execution 2021-02-22

      db.collection.createIndex({ 'a.$**': 1 })
      db.collection.insert({ a: { b: DBRef('1', '2') } })
      db.collection.find({ 'a.b': DBRef('1', '2') }).hint('a.$**_1')
      db.collection.find({ 'a.b.$ref': '1', 'a.b.$id': '2' }).hint('a.$**_1')
      

      The third line blows up with:

      Error: error: {
      	"ok" : 0,
      	"errmsg" : "error processing query: ns=test.collectionTree: a.b $eq { $ref: \"1\", $id: \"2\" }\nSort: {}\nProj: {}\n planner returned error :: caused by :: $hint: refusing to build whole-index solution, because it's a wildcard index",
      	"code" : 291,
      	"codeName" : "NoQueryExecutionPlans"
      }
      

      While the fourth one works fine. However, they mean the same thing so both should work.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            alien Boris Petrov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: