I am running a mongo database on Digital Ocean. I’ve set it up with the following tutorial: Mongodb setup and secured it with this tutorial: MongoDb security Now I am trying to create a dump of a particular database. I am using the following command as stated in this article: Backup & Restore Mongodb: sudo mongodump –db dbName –out /var/backups/mongobackups/date
Tag: mongodb
how can i get the value of a variable outside the arrow function in mern stack
i want to get the value of this variable outside the function const custDetail = await registeredUser.findOne(req.params); Answer Edit a simple way to pass data to another function using res.locals router: dashboardReq nextFunction
How do I get the same parent result regardless of the order of children being queried? (One to Many)
I’m building a chat with private rooms. What I’m trying to do is find a room that two users belong too. If there isn’t one create one. Chat Schema Query Controller The problem I’m having The order of the auth and receiver changes depending who is logged in and produces a different query result for chat. For example: Example One
What’s the point of using save() in Mongoose?
I’m learning MongoDB and Mongoose, and I’ve watched instructors advise to use the save() function to save the changes made to the database. But I’m still making changes successfully without using save(). I’ve made two functions to add a document to the database, one with using save() and the second one without using save(), and they all did the same
Why am I still getting an error with a DELETE request in Postman?
I’m kinda new to programming and I am trying to send a delete request to Postman but I keep getting this error in postman. Would anyone know how to fix this? ERROR: NOW, the delete request is working properly as I can see the query selection being deleted when I send the delete request but I am still getting that
Using new collections for each user
I am building an Expense Tracking app using Node.js where all the Income and Costs should get saved in a database. My idea is to create a new collection for each registered user and save all their income/cost actions in that collection. The things i would like to consider before writing it are: how do i name the collections Efficiency
Get access to the “current element” when traversing a mongoDB (mongoose) array
I have a mongoose model for a “social media like post” (called PostModel) that has this schema: I simply want to know the number of likes each comment got when querying for a post. This should not be as annoying and difficult as it is. I have spent more than 4 hours on this. What I have tried so far:
Server data coming through as [Object object] on client
I’m trying to display my data being sent from the server but it’s not coming through properly (see [Object object] in the bottom left of the image above). Here’s the client side code: The server is sending the data in an array in below format: I want the values from totalGuests and attendedGuests to display on the client. Here’s my
mongodb – match if a group of values from an array is in another given array [with Aggregation]
I’m looking for a solution since 3 hours and I don’t get it yet. I have the following collection: and I would like to have only the documents that have all the index values in a given array like for example [1,2,4] using the example above, I would like to have the following output: [1,2] is in [1,2,4] -> OK
Not able to connect MongoDB Atlas with Node.js trough Mongoose
I’m trying to connect a Node.js application with MongoDB Atlas trough Mongoose and I’m getting the following error: My code is: I’ve allowed access from every IP on mongodb atlas and when I try to connect directly to atlas everything works fine. Answer For first, you have double quotes in the connection variable. Secondly: it seems to me that mongoUri