我有一个类,其中包括用于MongoDB连接的Helper方法,包括Connect、FindDocuments和InsertDocument。
async findDocuments(collection, query) {
var response = await this.database.collection(collection).find(query).toArray();
return response;
}
console.log(mongo.findDocuments('users', {}));
我希望得到数据库中所有用户的列表。
我正在接受一个承诺。