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

$meta projection operator should overwrite fields

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL

    Description

      The functional spec states:
      If the operator encounters a document where the named field already exists, the operator will replace that field's value

      However, the opposite occurs:

      >  db.articles.find()
      { "_id" : 1, "subject" : "cake", "score" : 10 }
      { "_id" : 2, "subject" : "cakes and ale", "score" : 5 }
      { "_id" : 3, "subject" : "cakes and more cake", "score" : 6 }
       
       
      > db.articles.find(       {  $text: { $search: "coffee cake" } },       { score: { $meta: "text" } }     )
       
      { "_id" : 3, "subject" : "cakes and more cake", "score" : 6, "score" : 6 }
      { "_id" : 2, "subject" : "cakes and ale", "score" : 5, "score" : 5 }
      { "_id" : 1, "subject" : "cake", "score" : 10, "score" : 10 }
       

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: