Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1681

Query returns different results depending on order of items in query dictionary

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6
    • Component/s: Query Operations
    • None
    • Environment:
      RHEL7
      Python 3.6

      Unable to find source-code formatter for language: java. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      import pymongo
      import re
      
      mongo_client = pymongo.MongoClient("localhost", 27017)
      mongo_coll = mongo_client.get_database("primitive").get_collection("primitive_mixedarr")
      
      doc = [{'array_of_mixed_field': [re.compile(b'62', 0), 1]}]
      mongo_coll.drop()
      mongo_coll.insert(doc)
      query = {'array_of_mixed_field': {'$options': 's', '$regex': re.compile(b'62')}}
      query2 = {'array_of_mixed_field': {'$regex': re.compile(b'62'), '$options': 's'}}
      
      mongo_result = list(mongo_coll.find(query))
      mongo_result2 = list(mongo_coll.find(query2))
      assert mongo_result != []
      assert mongo_result2 != []
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            scottJsonar Scott [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: