Gabe
Gabe

Reputation: 6865

Query Entity by Regex Google Datastore

I would like to run a query in Google App Engine using Firestore in Datastore mode. What I want to accomplish is to query a string based on a regex. For example, I want a query that would return all entities that match a regex. I could not find anything about regex in the docs. I'm looking for something that would look like the following code.

query := datastore.NewQuery(kind).
    Filter("date =", myRegex)
//then run the query and so forth

Thanks for any help!


Edit: The regex I want to implement looks like the following `"1/\d\d/2020"

Upvotes: 0

Views: 489

Answers (1)

Thundercat
Thundercat

Reputation: 120941

Use the following query. A regexp is not needed.

query := datastore.NewQuery(kind).
    Filter("date >=", "1/00/2020").
    Filter("date <=", "1/99/2020").

Upvotes: 1

Related Questions