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

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

    XMLWordPrintableJSON

Details

    • ALL

    Description

      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
      }

      Attachments

        Activity

          People

            mathias@mongodb.com Mathias Stearn
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: