skip to Main Content

Mongoose aggregate query working as a mongodb query but not able to convert to mongoose

Below is my JSON structure [{ "_id" : ObjectId("626204345ae3d8ec53ef41ee"), "categoryName" : "Test Cate", "__v" : 0, "createdAt" : ISODate("2022-04-22T01:26:11.627Z"), "items" : [ { "itemName" : "Cate", "user" : ObjectId("6260729af547915d9d876c23"), "itemDescription" : "slkkndanslk", "itemImage" : "/images/camping-table.jpeg", "_id" : ObjectId("626204339b24b2ead6c05a70"), "updatedAt" :…

VIEW QUESTION

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
Back To Top
Search