📅  最后修改于: 2022-03-11 15:01:14.030000             🧑  作者: Mango
// Sort by symbol, skip the first 5, return at most 20, and don't hydrate
// the returned doc. See https://mongoosejs.com/docs/api.html#model_Model.hydrate
const query = Stock.find().sort({ symbol: 1 }).skip(5).limit(20).lean();
for await (const stock of query) {
const price = await superagent.
get(`https://api.iextrading.com/1.0/stock/${stock.symbol}/price`).
then(res => res.body);
console.log(stock.symbol, price);
// No `save()` because `stock` is lean
}