I have following data in my mongodb database , how can I write a mongoose query to select a particular object from "cartItems" which is a array of objects and update its "qty" and "price" filed. Here’s the data:- { ...
databaseanswers.net Latest Questions
I have the following graphql type defined for mongoose: const InjuriesSingleDay = new GraphQLObjectType({ name: 'SingeDayInjuryFigure', description: 'The number of injuries recorded on a single day', fields: () => ({ ...
In my document i have array of images in which each image has url and public_id. I want only the url public_id but addditional parameter of _id is also stored. Which i want to avoid. Stored in the database as: "images": [ ...
I need to migrate some data to my local mongodb database. so I created a seed function to save data to database from a CSV file. In my schema object I specify "members" field as Types.ObjectId[]. But instead it saves ...
I want to create a username from the user’s email, first name, and the last name entered. I am using NodeJs and Sequelize. I want to make it unique by continuously checking the database. How can I achieve this?
I made an adventure command that searches for a persons profile in a Mongo database, then uses that info to calculate xp, coins, etc. I have made several other commands that use the database that work perfectly. This one, however, ...
export const signup = async (req, res) => { const { name, email, password } = req.body; try{ const existinguser = await Users.findOne({ email }); ...
Im trying to get data from a collection stored in MongoDB. When i try to get the data in Insomnia everything works fine. When i make a request with axios i get the following error: Uncaught TypeError: Cannot read ...
After creating validators in a separate file to check if an email exists in mongodb users.findOne no longer works. How do I fix this issue? it was originally in auth.js and working correctly now it’s in validators.js. The project is ...
I am using NodeJS and MongoDB to store my data, and I would like to create some timeslots available for classes such that creators of that class would be able to indicate the dates and timings they’d be available and ...