pgj commented on code in PR #4810:
URL: https://github.com/apache/couchdb/pull/4810#discussion_r1372066930
##########
src/mango/src/mango_selector_text.erl:
##########
@@ -142,6 +142,10 @@ convert(Path, {[{<<"$exists">>, ShouldExist}]}) ->
true -> FieldExists;
false -> {op_not, {FieldExists, false}}
end;
+convert(Path, {[{<<"$beginsWith">>, Arg}]}) when is_binary(Arg) ->
+ Suffix = <<"*">>,
+ PrefixSearch = value_str(<<Arg/binary, Suffix/binary>>),
+ {op_field, {make_field(Path, Arg), PrefixSearch}};
Review Comment:
On that note, I would recommend to include spaces or other special
characters (subject to escaping) in the strings used in the tests. For example
(note the space after `"New"`):
```python
def test_beginswith(self):
docs = self.db.find({"location.state": {"$beginsWith": "New "}})
self.assertEqual(len(docs), 2)
self.assertUserIds([2, 10], docs)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]