startsWith condition for query
I was going through the Query docs and didn't come across a startsWith condition. Something that can be used a lot for things like
usersCollection.query(
Q.where("username", Q.sw("ja")),
Q.or(Q.where("full_name", Q.sw("ja")))
)
Is there native support for this or do I have to query all users and then do the filtering with JS, which doesn't sound very efficient?
You can use like operator (https://github.com/Nozbe/WatermelonDB/blob/master/docs/Query.md#conditions-with-other-operators):
Q.where("full_name", Q.like("John%"))
Thank you so much.
@anarkafkas It would be awesome if you could send a quick pull request with a documentation update — since it's clearly not obvious that one can use Q.like as "startsWith"
@radex Sure will do.