Is it possible to use ndb operator "IN" in a way, that I would search for a value in model's array?
For example
foo_1.array_of_values = ["item1", "item2"]
foo_1.put()
I would like to query like:
Foo.query("item2" in Foo.array_of_values)
So, is that even possible? Is there any workaround?
I don't want to fetch all entities and then filter them by myself.
Assuming that array_of_values
is a ndb.StringProperty(repeated=True)
then a regular equality filter will do the trick Foo.query(Foo.array_of_values == "item2")
https://cloud.google.com/appengine/docs/standard/python/ndb/queries#repeated_properties