Answers for "golang mongodb findone sort"

0

golang mongodb findone sort

findOptions := options.Find()
// Sort by `price` field descending
findOptions.SetSort(bson.D{{"price", -1}})


db.Collection("products").Find(nil, bson.D{}, findOptions)
Posted by: Guest on July-02-2021

Browse Popular Code Answers by Language