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

Regex not working properly on indexed fields..

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.6
    • Component/s: Querying
    • None
    • Linux
    • Hide
      db.test.insert({"path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda",})
      db.test.insert({"path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda,547958686a67b77b149b7cdd", })
      db.test.insert({"path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda,547958686a67b77b149b7cdd,547958686a67b77b149b7ce0", })
      db.test.ensureIndex( { path: 1 } )
      db.test.find({path:{$regex:',547958676a67b77b149b7c64'}})
      
      Show
      db.test.insert({ "path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda" ,}) db.test.insert({ "path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda,547958686a67b77b149b7cdd" , }) db.test.insert({ "path" : ",547958676a67b77b149b7c64,547958686a67b77b149b7c6e,547958686a67b77b149b7c6f,547958686a67b77b149b7c71,547958686a67b77b149b7c74,547958686a67b77b149b7c77,547958686a67b77b149b7c7a,547958686a67b77b149b7c7d,547958686a67b77b149b7c80,547958686a67b77b149b7c83,547958686a67b77b149b7c86,547958686a67b77b149b7c89,547958686a67b77b149b7c8c,547958686a67b77b149b7c8f,547958686a67b77b149b7c92,547958686a67b77b149b7c95,547958686a67b77b149b7c98,547958686a67b77b149b7c9b,547958686a67b77b149b7c9e,547958686a67b77b149b7ca1,547958686a67b77b149b7ca4,547958686a67b77b149b7ca7,547958686a67b77b149b7caa,547958686a67b77b149b7cad,547958686a67b77b149b7cb0,547958686a67b77b149b7cb3,547958686a67b77b149b7cb6,547958686a67b77b149b7cb9,547958686a67b77b149b7cbc,547958686a67b77b149b7cbf,547958686a67b77b149b7cc2,547958686a67b77b149b7cc5,547958686a67b77b149b7cc8,547958686a67b77b149b7ccb,547958686a67b77b149b7cce,547958686a67b77b149b7cd1,547958686a67b77b149b7cd4,547958686a67b77b149b7cd7,547958686a67b77b149b7cda,547958686a67b77b149b7cdd,547958686a67b77b149b7ce0" , }) db.test.ensureIndex( { path: 1 } ) db.test.find({path:{$regex: ',547958676a67b77b149b7c64' }})

      Please follow steps to reproduce bug.
      If i remove index on path field then it gives proper result count 3
      else it gives result count 2

            Assignee:
            Unassigned Unassigned
            Reporter:
            Jagdish Jagdish Idhate [X]
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: