This is simply add to cart function. Also means insert field to database. All is fine when it comes to adding to the database, however there is this error everytime I click add to cart(But still adds to database though). Here is my fetch code, leading to calling my controller. I’m not sure what json data is being returned here,
Tag: mongoose
TypeError: cb is not a function in nodejs?
(node:13384) UnhandledPromiseRejectionWarning: TypeError: cb is not a function I am using passport js for authentication for my website, I am able to get all routes but when I try to sign up that is post router so in the console I am seeing these err, my data saved in DB but after posting my page loading continuously. here these err
collection.find({}) doesnt work after many tries
I am building an api with express and mongoose and im usingdb.collection(collection).find({}) expecting that i get all of my docs back (3 test docs in total) as seen from tutorials. It doesnt give me any errors when im executing a req from postman and that confuses me as im geting nothing, not even an empty object or array as a
NodeJs push in array not working within the async function
Here is my code… When I’m trying to access schedule.passenger inside the async function It’s working but when trying to access outside the async function it’s not working. Answer forEach(async function will fire bunch of async functions and once array iterations are complete, the execution will move to next code block without waiting for all the async functions to complete.
change only one field of entire array of embedded document in mongoose
i have a list schema and a question set schema. the quetsionSet schema is embedded inside the list schema. its working fine but how can i update anything inside the array of embedded document i.e. here i want to change the listname of all the documents inside questionSet (array of questionSet documents). here is an example of my list document
update two layer nested object based on the id
I have this structure in my Mother Model (this is a fixed structure and I just push cards or update them on these 3 array levels): The Objects inside cards.advanced array above are like: Assuming I have access to Mother model like this: How can we update a card object based on its id and the level it belongs to
Mongoose error: “Topology was destroyed”, what’s the problem?
I was coding a leveling system for my discord bot, but encountered a mongoerror on the way, does anyone know why this is occuring? (The addXp function runs whenever someone chatted, the error is logged in the removeTimeout function.) I have used mongoose in many more ways in my code but this hasn’t yet occured before, I also did find
Mongodb Insert dynamic unique keys to nested object add if not exist else update
I need to operate something same as how $addtoset works for arrays in mongodb but for an object,Im adding dynamically generated objects to an object. The dynamic key is based on a string which will help to maintain a unique value so another key will not inserted with the same dynamic key. i tried $set which actually updates This is
Node.js throws TypeError: Cannot destructure property ‘firstName’ of ‘req.body’ as it is undefined, even though it works for an other post request
So I know there are tons of similar questions out there, and I’ve read most of them in the past few days. However I didn’t find any solution to my problem. The app is about users can post memories(cards) etc… Point is, when I create a new card with POST request, there is no problem, but when I want to
Is it possible to convert a buffer to base64string in populate mongoose?
I have a mongoose Image Schema as below: and a Chapter schema I’ll do population for the image and I’m trying to convert the buffer to base64string for every single image in the chapter. Could anyone please help me? is there a way to do conversion on populate function in mongoose? or I have to map and doing conversion inside