attempt to $project a computed _id field results in a document with two duplicate (wrong) _id values

XMLWordPrintableJSON

    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Observed behavior: Projecting to the _id field causes two _id fields to be written to the result document, both of which have source _id value not the computed _id value.
      Expected behavior: The result document's _id is computed based on the projection spec.

      Test:

      c = db.c;
      c.drop();
      
      c.save( { a:1 } );
      
      printjson( c.aggregate( { $project:{ _id:'$a' } } ) );
      

      Result:

      {
      	"result" : [
      		{
      			"_id" : ObjectId("4fe4ef9ed233d4cbc75b1246"),
      			"_id" : ObjectId("4fe4ef9ed233d4cbc75b1246")
      		}
      	],
      	"ok" : 1
      }
      

            Assignee:
            Mathias Stearn
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: