Open jeffj6123 opened 4 years ago
Hi @jeffj6123, sorry for the late answer!
Do you have an example on the Google doc (https://googleapis.dev/nodejs/datastore/latest/index.html) where it filters by an Array item and then property of the object? So I can understand better what you are trying to do. Cheers! 👍
Hey, @sebelga I am trying exactly where they mention it in their docs, but here is a reference to other people talking about it https://stackoverflow.com/questions/37290722/filter-entities-on-a-sub-entity-property-in-google-datastore-query . I have originally gotten familiar with it by using the python NDB where it allows for that.
Hey I wondered if there are any updates here?
Hello, sorry for the late answer. I don't have the bandwidth to work currently on the project but there is a new maintainer who will be taking the lead shortly. I am going to label this issue as feature request
and hopefully, we will be able to look into this.
In the short term, if by adding any
you manage to make the query work, that's an acceptable solution 😊
Hey, @jeffj6123 You can pass options with filter on nested properties:
Is there a proper way to query on a nested property like this example below.
` interface KeyValue { key: string; value: string; }
interface KeyValueContainer { container: KeyValue[]; }
// Pass it on Schema creation const schema = new Schema({
container: { type: Array, optional: false },
});
const Kvc = gstore.model('KVC', schema);
Kvc.query().filter("container.key", "=", "test"); ` At the last line I get Argument of type '"container.key"' is not assignable to parameter of type '"container"'.ts(2345)
it looks like the filter only accepts the top level properties. Is there a way to handle this query in gstore-node or do I need to drop down to the base google cloud library?
Like I can drop <any> in front of the "container.key" string to remove the error but that feels like a weak solution.