When I try to get the result of Aggregation, I will get an Pool Destroyed error.
A similar question in How to solve MongoError: pool destroyed while connecting to CosmosDB but first I don't set replicaSet and second the fix for microsoft doesn't work for me either.
I am using mongodb 6.4.1, nodejs 11.3.0, windows 10. MongoDb Atlas. (There is no need to set up ReplicaSet)
const collection = database.db("wholeData").collection("someData");
collection.findOne({"date": ts.todayTS}).then((data)=>{
collection.aggregate([
{$match: {}}
]).toArray(function(err, docs){
console.log(err);
console.log(docs);
})
});
Other operations are OK for me, like collection.findOne does have a result here.
I expect the output of all documents in this database, but it returns a pool destroyed error and nothing in result.