doujia7779
2017-11-22 20:24
浏览 100

从集合中检索最后一个文档时如何提高性能

Here is a statement where Limit() precedes Sort()...

var result Candle
dao.c.Find(bson.M{"symbol": "USD"}).Limit(1).Sort("-time").One(&result);

... and here is a statement where Limit() comes after Sort():

var result Candle
dao.c.Find(bson.M{"symbol": "USD"}).Sort("-time").Limit(1).One(&result);

Is there any performance difference between the statements above?

1条回答 默认 最新

相关推荐 更多相似问题