Search on 2 properties in MongoDB query
query := bson.M{ "nombre": bson.M{"$regex": `(?i)` + search}, // me va a buscar los nombres que contengan search } I had this code to do a search in my DB where I have name and surname. I want this query…
query := bson.M{ "nombre": bson.M{"$regex": `(?i)` + search}, // me va a buscar los nombres que contengan search } I had this code to do a search in my DB where I have name and surname. I want this query…
I am still new to Node JS. I am trying to make a book directory using Node JS and Mongo DB. Every time I press the delete button to delete a book it shows me this error CastError: Cast to…
I have a nextjs application I have been developing and need to find all the documents in one of my collections I am using the mongodb node module. when i use .find() to pull the documents I just get an…
Learning about the concept of microservices in Nodejs, I have set up two microservices auth and users, both standalone and running on different ports. The auth service handles user creation and log-in users using a username and password. This works…
I have a function that create guild entry for DiscordJS, but when the script start and also if the function is called multiple times, it create around 400 duplicate documents, it create by ID and the ID is unique, so…
I am a building a web-app where people have 10 coins by default, and when they click a buy button, it reduces the number of coins by 10 with each click. The schema for users is like this: const mongoose…
I'm trying to connect next.js app to mongodb via mongoose in _middeware file(./pages/_middleware.ts ) But I get this error on incoming requests: error - (middleware)node_modulesmongoosedistbrowser.umd.js (1242:0) @ ReferenceError: regeneratorRuntime is not defined How can I fix it?
I'm working on a podcast app that has an e-commerce section for which I am following this tutorial: https://www.youtube.com/watch?v=CDtPMR5y0QU I've been getting the following error from the network tab when I click the Place Order button: message: "Order validation failed:…
i post data to mongodb as following: app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended:true})); app.use('/insert',async(req,res)=>{ const newProduct=new product({ _id:req.body._id, name:req.body.name, description:req.body.description }); try{ await newProduct.save(); // res.json(newProduct); res.send(`${newProduct} inserted.`); //res.redirect('/'); } catch(err){ res.send(err); } }); Data is taken from the user. The user sends the…
I want to retrieve a user's chats with corresponding users from a different collection in NodeJS and MongoDB. The nature of NodeJS gives me a bad feeling that running the following code will block or decrease performance of my app.…