0

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

Kushal Bhalaik
  • 3,349
  • 5
  • 23
  • 46

1 Answers1

1

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

var doc = users.find({email: 'kb'}).toArray();
dnickless
  • 10,733
  • 1
  • 19
  • 34