appsync doesnt filter with arrays or doesnt support in and nin operators

0

Hi, I am trying to build a date app, and when I fetch user cards I want to filter these cards according to my dislikes and likes arrays to not show the cards that user has already rate.

In firebase world they implement this case as follow:

query(
collection(db, "users"),
where("id", "not-in", [...likedUserIds, ...dislikedUserIds])
)

But in amazon appsync query I cant filter with array but only id, as follow:

//this works    
const { data } = await API.graphql(
      graphqlOperation(getCards, {
        filter: { id: { ne: userId } },
      })
    );

But I need to filter with arrays like: const { data } = await API.graphql( graphqlOperation(getUsers, { filter: { id: { nin: [...likedUserIds, ...dislikedUserIds]} }, }) ); This doesnt work, how can I implement this nin query?

schema: type User @model { id: ID! other fields passes: [ID] swipes: [ID] matches: [ID] }

query: export const getCards = /* GraphQL */ query ListUsers( $filter: ModelUserFilterInput $limit: Int $nextToken: String ) { listUsers(filter: $filter, limit: $limit, nextToken: $nextToken) { items { id other fields } nextToken __typename } };

burakka
asked 7 months ago122 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions