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

105
Views
connection problem mongoDB with MongoClient

I have some problem about connection to my mongoDB with MongoClient.

const { MnogoClient , ObjectID} = require('mongodb')
const id = new ObjectID()
console.log(id)

const connectionURL = 'mongodb://127.0.0.1:27017'
const databaseName = 'task-manager'
MnogoClient.connect(connectionURL , {useNewUrlParser: true}, (error, client)=>{
if(error){
    return console.log(error)
}

const db = client.db(databaseName)
//insertOne is asyncronuse opration and beacuse we use callback function 

//for the collection we can assign my own property object id
db.collection('users').insertOne({
    _id: id,
    name: 'Mahdi',
    age: 24
} , (error , result)=>{
    if(error){
        return console.log('Unable to insert the document')
    }
    console.log(result.ops)
    
})})

i get TypeError: Cannot read properties of undefined (reading 'connect').

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

i think you have a typos error I can see there MnogoClient.connect

MongoClient.connect(connectionURL , {useNewUrlParser: true}, (error, client)=>{
if(error){
    return console.log(error)
}
....
....
})

about 4 years ago · Santiago Trujillo Report

0

const { MongoClient, ObjectID } = require('mongodb') // It's Mongo not mnogo

MongoClient
about 4 years ago · Santiago Trujillo 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!