One-to-many link not consistently returning objects in the correct order
See original GitHub issueGrapher appears to be inconsistent with how it treats the ordering of one-to-many links.
If I have a Post
document like this:
const myPost = {
commentIds: ['id1', 'id2'],
};
And a link between my Posts
and Comments
collection, I expect any grapher query to always return the 2 comments in the same order:
const myGrapherPost = {
comments: [{ _id: 'id1', ...moreData1 }, { _id: 'id2', ...moreData2 }],
};
However I’ve started seeing some queries come back with a different order, like this:
const myGrapherPost = {
comments: [{ _id: 'id2', ...moreData2 }, { _id: 'id1', ...moreData1 }],
};
It’s pretty hard to trace down, but I have this happening for 2 similar queries on the same collection, one with pure MongoDB data, and the other with an async Reducer fetching stuff from a third party API.
Is there a check somewhere that makes sure arrays are always ordered properly?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
hibernate OneToMany List ordering persisting but reversing?
I can completely re-order the java List in memory and when I save() the object the order of links in the linking table...
Read more >ActiveObject OneToMany relationship returning an empty array
ActiveObject OneToMany relationship returning an empty array ... when I call getOrders(), it returns the correct objects from ComponentOrder.
Read more >The best way to map a @OneToMany relationship with JPA ...
The @ManyToOne annotation allows you to map the Foreign Key column in the child entity mapping so that the child has an entity...
Read more >Best Practices for Many-To-One and One ... - Thorben Janssen
Best Practices for Many-To-One and One-To-Many Association Mappings · 1 Don't use unidirectional one-to-many associations · 2 Avoid the mapping of huge to-many ......
Read more >Relationship Loading Techniques
Eager loading refers to objects returned from a query with the related collection or scalar reference already loaded up front.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Floriferous yes ofcourse, but like this:
Is it possible that this nested
$options
can only go one level deep?I’m getting an uncaught error:
MinimongoError: Projection values should be one of 1, 0, true, or false
when adding$options
in one of my shared “fragments” across collections.i.e. is something like this allowed ?:
What else could be causing this issue?