$or paired with upsert does not create documents for each or clause

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 1.6.2
    • Component/s: Write Ops
    • None
    • Environment:
      mongodb 1.6.2, pymongo-1.8.1, python 2.6
    • Query
    • OS X
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When multiple keys are put together with an $or expression and the upsert flag is sent to update (and the multi flag is set) objects are not created for the items in the $or expression.

      This code using pymongo:

      keys = []
      for item in items:
      key =

      { 'a : item.a, 'b' : item.b, 'c' : item.c }

      keys.append(key)

      if len(keys) == 0:
      return

      query =

      { '$or' : keys }

      value = {
      '$inc' :

      { 'count' : 1 }

      }

      db.abc_counts.update(query, value, upsert=True, multi=True)

      Produces this in the DB:

      { "_id" : ObjectId("4c8e7161010f681721439e58"), "count" : 1 }

      if i replace query with keys[0] it works as expected.

              Assignee:
              Backlog - Query Team (Inactive)
              Reporter:
              jeff jenkins
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: