How fields order are chosen

Hi,

we use graphql with realm and don’t understand how fields are ordered.

Is it with the schema?

Yes - the order of how fields appear in your GraphQL schema is a result of how they are ordered in your Realm Schema

1 Like

It’s seems that when i save / deploy a schema, it’s ordered by alphabetic order.
And it doesn’t even order them this way when i save a document.

Ah you’re right - when I confirmed, my schema happened to be in alphabetical order already.

Is there a reason why you want to choose the order of your fields?

For readability, specially in developement mode, we end up with different order for each document.

Can you elaborate on what you mean by development mode? Are you referring to developing or the “Development Mode” related to our Sync offering?

I’m also not quite sure what you mean by different order for each document, do you mind providing an example?

Thank you Sumedha for your quick replies.

I meant “when not in production mode”, we edit fields manually sometimes. To have them not in the same order is kind frustating.

Without editing the schema or the front we have this:

2020-10-16 11_03_59-Data _ Atlas_ MongoDB Atlas

2020-10-16 11_04_31-Data _ Atlas_ MongoDB Atlas

Plus we have an issue with date we don’t understand, from the front we send a new date(). But it retrieve 2 hours in atlas. We use graphql.

Without editing the schema or the front we have this

Where are you getting these screenshots from? Is this from postman/a client call? or are you getting this somewhere from Atlas?

Plus we have an issue with date we don’t understand, from the front we send a new date(). But it retrieve 2 hours in atlas. We use graphql.

Do you mind going more into detail about your issue with date? Is it adding 2 hours to the date added? And do you mind pasting your code that’s inserting the date?

From mongoDB Atlas.

For the date, it compare with local date of the server in the triggers. So we have +2h.
We are in france.
Can we setup the GMT in the mongodb realm app ? To have same hours.

Any idea, will it be fixed?

Hi @Nabil_Ben - the question about order on Atlas is for the Atlas team. I suggest filing a request for them to respect order here - https://feedback.mongodb.com/forums/924145-atlas

On the other hand, respecting the schema order on GraphQL is something that we are considering, but would still be at least a few months out if implemented.

1 Like

@Nabil_Ben Wanted to follow up on my original answer here, apologies for not understanding your question the first time around -

This is a limitation of the GraphQL API at the moment due to some pre-processing we do on the GraphQL API before we perform the MongoDB insert due to the un-ordered nature of JS objects.

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