[SERVER-39694] Implement $regexMatch as syntactic sugar on top of $regexFind Created: 20/Feb/19  Updated: 29/Oct/23  Resolved: 20/Mar/19

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

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Arun Banala
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-39695 Implement $regexFind Closed
Documented
Related
is related to SERVER-11947 Add a regex expression to the aggrega... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2019-03-25
Participants:

 Description   

$regexMatch (or whatever we decide to call it) will evaluate to a boolean indicating whether any part of the provided string matches the regex.



 Comments   
Comment by Githook User [ 20/Mar/19 ]

Author:

{'email': 'arun.banala@mongodb.com', 'name': 'Arun Banala', 'username': 'banarun'}

Message: SERVER-39694 Fix undefined behaviour with string.front() when empty
Branch: master
https://github.com/mongodb/mongo/commit/8af009307fa1f5f51e839ac45921f64a11e1b2dd

Comment by Githook User [ 20/Mar/19 ]

Author:

{'email': 'arun.banala@mongodb.com', 'name': 'Arun Banala', 'username': 'banarun'}

Message: SERVER-39694 Implement $regexMatch as syntactic sugar on top of $regexFind
Branch: master
https://github.com/mongodb/mongo/commit/b72e0f72f94f219fcc19654e0aa037482c0f7cee

Comment by Asya Kamsky [ 12/Mar/19 ]

david.storch yes I think that would be fine - since it's a new expression, it's not backwards breaking.

Comment by David Storch [ 12/Mar/19 ]

asya, do you mean it seems ok for $regexMatch to throw a query-fatal error if the input type is not a string? That would be the easiest for us to implement, since it preserves the property that $regexMatch is syntactic sugar.

Comment by Asya Kamsky [ 08/Mar/19 ]

That seems ok to me.

 

Comment by Ian Boros [ 06/Mar/19 ]

asya: arun.banala and I were talking over slack and a point came up about whether or not $regexMatch should error if the input value given is not type string. For $regexFind and $regexFindAll we've agreed to error in that situation, but for $regexMatch, we could see an argument for returning 'false'. i.e. $regexMatch will return true if the input type is string and it matches the regex, and false otherwise. What do you think?

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