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
posta 8 mesi fa126 visualizzazioni
Nessuna risposta

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande