Kushal Bhalaik
Kushal Bhalaik

Reputation: 3384

No Matching record is found IN MongoDB Stitch app webhook function

I have a MongoDb ATLAS database as "BOULDERS_MAIN" and a collection inside it "users", I am writing a webhook function for returning a user based on email i.e. "kb", but all I'm getting is empty object.

enter image description here

Upvotes: 0

Views: 159

Answers (1)

dnickless
dnickless

Reputation: 10918

MongoDB's find() returns a cursor object not the results. Try calling toArray() on the result instead:

var doc = users.find({email: 'kb'}).toArray();

Upvotes: 1

Related Questions