-
Notifications
You must be signed in to change notification settings - Fork 245
WIP: order latest first COMPASS-6706 #6361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/compass-query-bar/src/constants/query-option-definition.ts
Outdated
Show resolved
Hide resolved
| preferences: PreferencesAccess, | ||
| ns: string, | ||
| filter: BSONObject, | ||
| filter: BSONObject | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by
| dataService: DataService, | ||
| serverVersion: string, | ||
| isDataLake: boolean, | ||
| fetchDocumentsOptions: FetchDocumentsOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting ugly 😆
| collectionStats: CollectionStats | null | ||
| ): Sort | undefined { | ||
| if (collectionStats?.index_details._id_) { | ||
| return { _id: -1 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now not sure. It seems like { $natural: -1 } is actually just as fast as { $natural: 1 } *(the default) at least in most cases. If it is in MOST cases we'd have to just change this logic and return { $natural: -1 }. If it works and is fine in ALL cases, then most of this PR is probably not needed. We could just always use that as a default and we don't even need this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then.. I don't think we want $natural at all because it's just how documents are sorted in wiredtiger, which means any order really. For example, an update can bump an old document to the top of the natural order.
| "hadron-type-checker": "^7.2.3", | ||
| "jsondiffpatch": "^0.5.0", | ||
| "lodash": "^4.17.21", | ||
| "mongodb": "^6.9.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the Sort type.
TODO:
Super hacky, will need lots of cleanup but at least we can try it out.
{ _id: -1 }for normal collections, undefined whenever the_id_index does not exist. ie. timeseries and views.