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

$project exclusion doubles _id field in console output

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.1
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Environment:
    • Operating System:
      Linux

      Description

      > db.test.save(

      {a:1,b:2}

      )
      > db.test.save(

      {a:3,b:4}

      )

      > db.test.find()

      { "_id" : ObjectId("4f6ba4a90a07b1052bfdb5e0"), "a" : 1, "b" : 2 } { "_id" : ObjectId("4f6ba4b40a07b1052bfdb5e1"), "a" : 3, "b" : 4 }

      > db.test.aggregate({$project:{a:0}})
      {
      "result" : [

      { "_id" : ObjectId("4f6ba4a90a07b1052bfdb5e0"), "_id" : ObjectId("4f6ba4a90a07b1052bfdb5e0"), "b" : 2 }

      ,

      { "_id" : ObjectId("4f6ba4b40a07b1052bfdb5e1"), "_id" : ObjectId("4f6ba4b40a07b1052bfdb5e1"), "b" : 4 }

      ],
      "ok" : 1
      }

      Repeated attribute is obviously not possible, so this seems very minor, but is a bit unexpected to see and object come back like this.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: