skip to Main Content

Mongodb – how to access object inside the array?

{ "_id" : ObjectId("64caa6599b2ec8d2da9e8e58"), "message" : { "text" : "hey" }, "users" : [ { "from" : "64c7acfbe872c97c7912ca09", "to" : "64c2d5612172d620ac18714f" } ], "sender" : ObjectId("64c7acfbe872c97c7912ca09"), "createdAt" : ISODate("2023-08-02T18:54:17.176+0000"), "updatedAt" : ISODate("2023-08-02T18:54:17.176+0000"), "__v" : NumberInt(0) } I want to access…

VIEW QUESTION

Unable to access data from mongoDB?

I followed a tutorial, connected to mongoDB via mongoose, but for some reason the console.log(data) doesn't show anything. const mongoose = require('mongoose'); const mongoURI = 'mongodb+srv://gofood:[email protected]/?retryWrites=true&w=majority' process.on('uncaughtException', err => { console.log('UNCAUGHT EXCEPTION! 💥 Shutting down...'); console.log(err.name, err.message); process.exit(1); }); async…

VIEW QUESTION
Back To Top
Search