skip to Main Content

Can't iterate over mongodb array

We are looking for a user in the database by '_id' "_id": "6381e7c6bf8892cf05c7c798", "username": "Teacher", "email": "[email protected]", "role": "teacher", "avatar": "fixtures/teacher.jpg", "token": "KNuSF7sscU3EJsMetUFKi", "authentication": true, "myCourses" and It is necessary to get a suitable object from the array using 'aggregate',…

VIEW QUESTION

update all fields mongodb node.js

I have this code: const database = client.db("Cluster0"); const collection = database.collection("people"); let data = { ...req.body} let doc = collection.updateOne( { id: req.body.id }, {$set: {}} ) what I am trying to do is update the entire document with…

VIEW QUESTION
Back To Top
Search