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

Projecting {$meta: "textScore"} over existing fields creates a duplicate key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.5.4
    • Fix Version/s: None
    • Component/s: Querying, Text Search
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      > db.test.find(
          { $text: { $search: "dog" } },
          { _id: { $meta: "textScore" } }
      )
      {
        "_id": 2,
        "words": "dog cat",
        "_id": 2
      }

      Show
      > db.test.find( { $text: { $search: "dog" } }, { _id: { $meta: "textScore" } } ) { "_id" : 2, "words" : "dog cat" , "_id" : 2 }

      Description

      When projecting the {$meta: "textScore"} field over _id the resulting documents contain two _id fields which is impossible in javascript as keys in objects must be unique. Something is wrong here.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: