I have a basic function containing this code:
const body = EJSON.parse(payload.body.text());
if(body[i].userID == ""){
var id = BSON.ObjectId(body[i].objectID);
coll.deleteOne({"_id": id});
}
My webhook is receiving an array of objects (This code is inside a for loop, the “i” indexing works fine). If the userID field of the object is null/an empty string, then I want to delete that object. Any suggestions? I feel like this is really simple.