yoursweater
yoursweater

Reputation: 2041

Can you filter for a property that only half of the queried entries possess?

Let's say I have 10 type Foo entries in my DB, and half look like

{
 bar: Boolean
 baz: Boolean
}

and the other half is missing that property, because they're legacy entries that occurred before the schema was updated, and they look like:

{
 bar: Boolean
}

Now, I want to filter for baz, but half of my entries don't even have that property. What happens if I run a filter here? Will it run correctly if i say {baz: {contains: 'true'}} ?

Using AWS AppSync to manage my GraphQL server, which interfaces with DynamoDB, by the way.

Upvotes: 0

Views: 48

Answers (1)

yoursweater
yoursweater

Reputation: 2041

After doing some more research, it turns out that after updating your Schema AppSync will actually return that property with a value of null, so you can safely filter. However, note that in DynamoDB you won't see a column that contains those null values... the column just isn't there, so I'm assuming the property is generated by the GraphQL resolver when it fails to find the value in DynamoDB.

Upvotes: 1

Related Questions