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

$project exclusion doubles _id field in console output

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.1
    • Affects Version/s: 2.1.0
    • Component/s: Aggregation Framework
    • None
    • Environment:
    • Linux

      > 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.

            Assignee:
            cwestin Chris Westin
            Reporter:
            crudson Doug Hudson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: