📜  golang mongodb findone sort - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:51.785000             🧑  作者: Mango

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


db.Collection("products").Find(nil, bson.D{}, findOptions)