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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • Querying, Sharding
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: