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

aggregate $out fails when the _id is projected out with 4.1-latest

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • ALL

      aggregate fails when the _id is projected out with 4.1.1-293-g3927b18

      PRIMARY> db.test.insertOne({foo:1})
      {
      	"acknowledged" : true,
      	"insertedId" : ObjectId("5b6e094002374d6d7383f3e2")
      }
      PRIMARY> db.test.aggregate([{"$project": {"_id": false, "foo": true}}])
      { "foo" : 1 }
      PRIMARY> db.test.aggregate([{"$project": {"_id": false, "foo": true}}, {'$out': 'output-collection'}])
      assert: command failed: {
      	"operationTime" : Timestamp(1533937989, 2),
      	"ok" : 0,
      	"errmsg" : "Failed to extract unique key from input document: { foo: 1.0 }",
      	"code" : 50905,
      	"codeName" : "Location50905",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1533937989, 2),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      } : aggregate failed
      

      Tested on:

      $ ~/Downloads/mongodb-macos-x86_64-enterprise-4.1.1-293-g3927b18/bin/mongod --version
      db version v4.1.1-293-g3927b18
      git version: 3927b187d07cd5e9c9ebba26ecf9500b261f57fc
      allocator: system
      modules: enterprise
      build environment:
          distarch: x86_64
          target_arch: x86_64
      

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: