findOne is an async function. You either can “await” the result or you can use .findOne(…).then(doc => { … }).
try the following:
exports = async function(arg){ let collection = context.services.get("mongodb-atlas").db("sample_mflix").collection("movies"); let doc = await collection.findOne({"title": arg}); return {doc}; };