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, |
| dataService: DataService, | ||
| serverVersion: string, | ||
| isDataLake: boolean, | ||
| fetchDocumentsOptions: FetchDocumentsOptions, |
There was a problem hiding this comment.
This is getting ugly 😆
| collectionStats: CollectionStats | null | ||
| ): Sort | undefined { | ||
| if (collectionStats?.index_details._id_) { | ||
| return { _id: -1 }; |
There was a problem hiding this comment.
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.
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.
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.