Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2601

find(Filters.regex("bad field","anything")) Returns Records from Wrong Collection!!

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 3.4.0
    • Component/s: Query Operations
    • Labels:
      None
    • Environment:
      Centos 6.8 and Java 1.8.0_66. Java driver version 3.4.2. Mongodb server version mongodb-linux-x86_64-rhel62-3.4.5. Not sure why 3.4.5 is not an option for "affects versions".

      This 3.4.5 db has a number of collections (about 10). When I query a collection by

      mycollection.find(Filters.regex("field","anything matching")) 
      

      against one collection, I generally get valid records from the WRONG COLLECTION if "field" is not actually a field of the documents in the chosen collection. If "field" is a valid field, or if I use eq instead of regex, this does not happen.

      I would expect to get no matches if "field" is not present in the documents in the collection referred to by "mycollection".

      Short of adding a lot of code to verify that only "field" names are used that are actually in the documents, I don't see any way to fix this problem. Please help!

            Assignee:
            Unassigned Unassigned
            Reporter:
            jschatzman James Schatzman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: