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

can't do non-multi update or upsert with single-value $in query predicate on shard key

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying, Sharding
    • Labels:
      None

      Symptom:

      db.timeline_cache.update({_id: { $in: ["100"]} }, { $push: { _c: { $each: [ { _id: ObjectId('53a20638e4b0df77093c1abb'), _a: "asya", _m: "OMG, this SUCKS!!!" } ], $slice: -15 } } })
      update { q: { _id: { $in: [ "100" ] } }, u: { $push: { _c: { $each: [ { _id: ObjectId('53a20638e4b0df77093c1abb'), _a: "asya", _m: "OMG!!!" } ], $slice: -15.0 } } }, multi: false, upsert: false } does not contain _id or shard key for pattern { _id: "hashed" }
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 61,
      		"errmsg" : "update { q: { _id: { $in: [ \"100\" ] } }, u: { $push: { _c: { $each: [ { _id: ObjectId('53a20638e4b0df77093c1abb'), _a: \"asya\", _m: \"OMG, this SUCKS!!!\" } ], $slice: -15.0 } } }, multi: false, upsert: false } does not contain _id or shard key for pattern { _id: \"hashed\" }"
      	}
      })
      

      The same update with _id:"100" works fine. Arguably $in:100 could be interpreted during upsert as equality.

            Assignee:
            Unassigned Unassigned
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: