I’m creating a trigger for new entries in my comment collection. When a user leaves a comment, I want mongo to create a new entry in my notification collection with the comment and the post data. To get the data from the post collection, I’m executing post.find( ) but I’m getting an empty object. What am I doing wrong?
@Pavel_Duchovny when I convert it to BSON, I get this error:
Error:
{“message”:“ObjectId in must be a single string of 12 bytes or a string of 24 hex characters”,“name”:“Error”}
I tried executing the .find without any parameter but I’m still getting an empty object. const specificPost = await posts.find();
It works fine when I execute separate as a mongodb realm function but when I call the function from the trigger I get an empty object. This is what I get when I console.log specificPost in both case above:
Logs:
[
“[object Object]”
]
I’m wondering if this issue has anything to do with permissions or access to the databases.