Skip to content

query filter on nested property value. #222

Description

@jeffj6123

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions