skip to Main Content

Mongodb – TypeError: callback is not a function node js

I am trying learn nodejs and stumble upon this error TypeError: callback is not a function and here is the code for my server.js var mongoose = require('mongoose'); mongoose.createConnection('mongodb://localhost/fruitsDB',{useMongoClient:true}, { useNewUrlParser: true },{useUnifiedTopology: true},()=>{console.log('Connected')}); const fruitSchema = new mongoose.Schema({ name:…

VIEW QUESTION

Print collection in a list of a collection in mongodb in golang

To print a collection from mongodb the following is my code in python: print(list(MongoClient(***).get_database("ChatDB").get_collection("room_members".find({'_id.username': username}))) I am learning Go and I am trying to translate the aforementioned code into golang. My code is as follows: client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("*****"))…

VIEW QUESTION
Back To Top
Search