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

132
Views
Get value from MongoDB

I am new in MongoDB. I have a MongoDB collection with structure like in the image below.collection structure

I want to console log the value of item. So, I want to console log "journal". How can I do that? I would appreciate any help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost/EmployeeDB';
var ObjectId = require('mongodb').ObjectId;

MongoClient.connect(url, function(err, db) {

    db.collection('collection_name').findOne({
        _id:ObjectId("61412a7bf30b9 .... ") /// doc _id
    }).then(r=>{
      console.log(r.item)
    });
});
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!