Skip to content

Commit

Permalink
update sort
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-bate committed Dec 12, 2023
1 parent af1c825 commit 2bd7ebf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ func (m *Migration) getOplogDuration() (time.Duration, error) {
if result := oplogC.FindOne(
m.ctx,
bson.M{"wall": bson.M{"$exists": true}},
options.FindOne().SetSort("$natural")); result != nil {
options.FindOne().SetSort(bson.M{"$natural": 1})); result != nil {

log.Printf("oldest walltime mongo result %#v", result)
if result.Err() != nil {
return 0, result.Err()
}
Expand All @@ -242,7 +244,7 @@ func (m *Migration) getOplogDuration() (time.Duration, error) {
if result := oplogC.FindOne(
m.ctx,
bson.M{"wall": bson.M{"$exists": true}},
options.FindOne().SetSort("-$natural")); result != nil {
options.FindOne().SetSort(bson.M{"$natural": -1})); result != nil {
if result.Err() != nil {
return 0, result.Err()
}
Expand Down

0 comments on commit 2bd7ebf

Please sign in to comment.