Answers for "find options mongo golang order by field"

Go
0

find options mongo golang order by field

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 November-03-2020

Browse Popular Code Answers by Language