Realm GraphQL returns different number of object when called with Postman

This project uses MongoDB’s Realm tutorial. Currently I am learning GraphQL. I tried to to use Postman to do a query, but I got different result than what in GraphiQL in Realm dashboard.


Postman only received one user document, where it should have two user document like what in GraphiQL. Am I missing something here?

curl also has the same return as Postman.

❯ curl --location --request POST 'https://realm.mongodb.com/api/client/v2.0/app/tasktracker-imnrs/graphql' \
         --header 'email: --------' \
         --header 'password: --------' \
         --header 'Content-Type: application/json' \
         --data-raw '{"query":"query AllMovies {\n  users {\n    name\n }\n}"}'
{"data":{"users":[{"name":"first@example.com"}]}}

Nevermind. I forgot in the tutorial app we implement partition. That’s explain why the returned data is only one, because the user only have access to their own data (in contrast to GraphiQL, which execute as System User).

2 Likes

Hello @mangkoran

Indeed, when using the GraphiQL tool inside your Realm App, it bypasses all the authentication and access rules.

In this scenario, what you explained in your last comment is correct and perfectly summarizes the problem you were experiencing.

I’m glad you were able to detect it and continue working.

Please let me know if you have any additional questions or concerns regarding the above details.

Best regards,
Josman

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.