【发布时间】:2019-01-04 11:27:48
【问题描述】:
我尝试使用基于 another post 的 'await' 关键字使用 mongoose ODM 进行同步查询,如下例所示:
const query= userModel.find({});
const syncResutlt= await query.exec();
console.log(syncResutlt);
但我收到此错误消息:
const result2 = await query.exec();
^^^^^
SyntaxError: Unexpected identifier
我也试过yield generator 关键字,但我总是得到同样的错误
SyntaxError: Unexpected identifier
有关信息,我有 nodeJs V8。
【问题讨论】:
标签: node.js mongoose synchronous