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

Inserting array values for shard key succeeds when shard key is _id and inserts garbage data

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.2
    • Affects Version/s: 2.0.6, 2.1.2
    • Component/s: Sharding
    • None
    • ALL

      mongo
      MongoDB shell version: 2.0.4
      connecting to: test
      test[14:7:40]> sh.shardCollection('test.bar', {i:1})
      test[14:7:53]> db.bar.insert({i : [1, 2]})
      tried to insert object with no valid shard key for { i: 1.0 } : { _id: ObjectId('5005aa08ba72dc4f64314847'), i: [ 1.0, 2.0 ] }
      test[14:8:9]> sh.shardCollection('test.baz', {_id:1})
      test[14:8:25]> db.baz.insert({_id : [1, 2]})
      test[14:8:34]> db.baz.find()
      { "_id" : ObjectId("5005aa223af26b5b5e49a1be"), "_id" : ObjectId("5005aa223af26b5b5e49a1be") }
      

            Assignee:
            matulef Kevin Matulef
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: