[SERVER-2991] Nice to have bson fields returned in determined order to making loading into data type / object faster. Created: 23/Apr/11 Updated: 06/Dec/22 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.8.1 |
| Fix Version/s: | features we're not sure of |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Tony Hannan | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
If the bson fields are in a known order then they can be mapped/loaded into the data type directly. Otherwise, you have to use a dictionary to map bson fields to object fields. Mongo could specify the order (eg. sorted) and the data type could be made to match that. Alternatively, a query with a projection (subset of fields to retrieve) can return documents with fields ordered the same as the projection. |
| Comments |
| Comment by Greg Weber [ 23/Apr/11 ] |
|
Just to clarify, we have an "ORM" with a MongoDB backend: http://www.yesodweb.com/book/persistent. Many other ORMs will lazily access MongoDB fields from a hash so they don't care as much about ordering. In our case, we are immediately instantiating a data structure. So we need to match up all the mongo fields with the data structure fields. The fastest way is to have a guarantee on the ordering of the fields returned from the server. This could come from a guarantee that they won't change on update as part of addressing |