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

Using a dbref in a query nested in an "$in" gives "cannot next $ under $in" error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.5
    • Affects Version/s: None
    • Component/s: Querying
    • Environment:
      MacOSX
    • ALL
    • Hide

      Drop some dbrefs into a document and query against it using $in.

      Show
      Drop some dbrefs into a document and query against it using $in.

      This query works in all 2.5.1 (unstable) and all stable builds:

      db.roles.find({ "owner": {
      	"$ref": "users",
      	"$id": ObjectId("51fac2e08c0c23f6c3000046")
      }});
      

      This query does not work in 2.5.1 (unstable) but does work in all stable builds:

      db.roles.find({ "owner": {
      "$in": [
                  {
                      "$ref": "roles",
                      "$id": {
                          "$id": "51fac2de8c0c23f6c3000030"
                      }
                  },
                  {
                      "$ref": "roles",
                      "$id": {
                          "$id": "51fac2de8c0c23f6c3000031"
                      }
                  }
            ]
      }});
      

      Here is a sample document:

      {
        "dateInserted": 1375388467,
        "dateUpdated": 1375388545,
        "owner": [
          {
            "$ref": "users",
            "$id": ObjectId("51fac2e08c0c23f6c3000046")
          }
        ],
        "name": "Search Manager",
        "key": "search-manager"
      }
      

        1. server10416.js
          0.3 kB
          Benety Goh

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            liquidg3 Taylor Romero
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: