Hi Team
I am trying to write a script in Atlas trigger.
but getting below error when i am executing simple function call.
{“message”:“‘countDocuments’ is not a function”,“name”:“TypeError”}
Service name, db and collection names are correct. Can anyone help on this
this is the script
exports = async function() {
const collection = context.services.get(“XXXXXXX”).db(“XXXxxx”).collection(“Xxxccxc”);
const count = await collection.countDocuments();
console.log(“Count:”, count);
};
Regards
Dinesh
Hi Dinesh,
Have you tried Count Documents in the Collection count()
?
Regards,
Jason
Dinesh_S2
(Dinesh S)
June 30, 2023, 10:53am
3
Hi Jason
There is issue with any function (DeleteMany, DeleteOne etc) i am using in the script.
Is there any class or library that has to be included in the script.
regards
Dinesh
With regards to the original topic about countDocuments()
, I was not able to find this in the Atlas App Services - MongoDB API reference . However, this contains the deleteMany()
and deleteOne()
functions. Can you further clarify what you mean by “issue”?