[SERVER-19923] regular expression not working with Comparison Operators Created: 13/Aug/15  Updated: 13/Aug/15  Resolved: 13/Aug/15

Status: Closed
Project: Core Server
Component/s: JavaScript, Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Gaurav Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

EX:
1. db.dx_product.find({'Brand.value':{'$eq':/^demo$/i}})
2. db.dx_product.find({'Brand.value':{'$eq':/Demo/i}})

not giving any result



 Comments   
Comment by Sam Kleinman (Inactive) [ 13/Aug/15 ]

Hello,

Thanks for the report. I believe that this is actually the expected behavior: regular expressions are not equality matches, so the queries that you posted are expressible in following form: (in the JS shell, other languages have different representations.)

{"field": /<regex>/<option>}

If you need to use a regular expression in a nested form, you can use the regex operator.

Sorry for the confusion.

Regards,
sam

Generated at Thu Feb 08 03:52:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.