Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Resolve result in MongoDB

How can I resolve result. Currently, my code doesn't resolve result and console logs "Successfully found document: [Object object]". This is MongoDB. I would appretiate any help.

await dbo.collection("a").findOne({ item: "journal" }, {_id:0})
  .then(result => {
  async function rs() {
await result
  }
    rs()
    if(result) {
      console.log(`Successfully found document: ${result}.`);
    } else {
      console.log("No document matches the provided query.");
    }
    return result;
  })
  .catch(err => console.error(`Failed to find document: ${err}`));

This is my MongoDB document:

_id:61462a7bf3c0be993bcfdc3e
item:"journal"
qty:25
size:Object
status:"A"
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try doing:

const results = await dbo.collection("a").findOne({ item: "journal" })

if(!!results) {
   console.log(`Successfully found document: ${JSON.stringify(result)}.`);
}
else {
   console.log("No document matches the provided query.");
}

// rest of the logic

Make sure the code above that you are executing is wrapped inside an async function.

Feel free to ask any future questions. Thanks :)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!