如何在节点js中一次找到多个mongo db objects
How to find multiple mongo db objects at once in node js
我正在尝试 运行 搜索,它与 findOne 一起工作正常并接收数据,但是当我使用时发现它只是 return 一些 headers 和这样的原型
response i am getting
代码
let data = await client
.db("Movies")
.collection("movies")
.find();
console.log(data);
请告诉我哪里错了
The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.
那就试试吧
let data = await client
.db("Movies")
.collection("movies")
.find({}).toArray();
console.log(data);
我正在尝试 运行 搜索,它与 findOne 一起工作正常并接收数据,但是当我使用时发现它只是 return 一些 headers 和这样的原型
response i am getting
代码
let data = await client
.db("Movies")
.collection("movies")
.find();
console.log(data);
请告诉我哪里错了
The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.
那就试试吧
let data = await client
.db("Movies")
.collection("movies")
.find({}).toArray();
console.log(data);