skip to Main Content

How to group two arrays in mongoDB?

I have a collection of documents books: { title: "My book", authors: [{id: 1, date: "2023-12-20"},{id: 2, date: "2023-12-21"}], authorsDetails: [{id: 2, name:"Author 2", age: 25}, {id: 1, name: "Author 1", age: 38}], } I need to do an aggregation…

VIEW QUESTION

'ERR_MODULE_NOT_FOUND' getting error while connecting to mongoDB

I am new to JavaScript and currently learning mongoDB with node and mongoose. when I try to connect with db, i got this error: Did you mean to import ../config/dbConfig.js? at finalizeResolution (node:internal/modules/esm/resolve:255:11) at moduleResolve (node:internal/modules/esm/resolve:908:10) at defaultResolve (node:internal/modules/esm/resolve:1121:11) at…

VIEW QUESTION

MongoDB format data in an array of objects

I have data on a MongoDB collection stored in documents like these: { "_id": "657c54befca2b6a2cdd935ba", "data": { "name": "Bob", "surname": "xxx", "age": "20", }, "header": { "data": "1702646974156", } "_class": "Prova" } { "_id": "657c54befca2b6a2cdd935bb", "data": { "name": "Tom", "surname":…

VIEW QUESTION
Back To Top
Search