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
everyone. I hope you’re doing well. Today, I want to talk to you about my next app, which I’m planning to develop only for the purpose of learning how to use the MERN stack. I want to develop a website ...
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 got the error Error: Cannot find module './setDocumentTimestamps' while trying to run my node application with Heroku as a host. I did not get any errors when trying to run the same command/script on my pc though. I have tried ...
I’m working on a project where I’m using mongoose for writing, updating and so on in Mongo DB. I call updateOne() function in my own custom function, but the thing is if I use const resp = await seasonFixturesModel.updateOne({season_id: season_id, "fixtures.274704.id": 18535224},{$set:{"fixtures.274704.$":{} ...
I’m trying to build a filter where it should be possible to query all items selected in an array, but also to show documents where the property has not been set. returning all specific from an array works fine with below ...
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 ...
Suppose you have two mongoose schemas: Meal and Ingredient. Meal const mealSchema = new mongoose.Schema({ title: { type: String }, ingredients: [{ ingredient: { type: mongoose.Types.ObjectId, required: true, ref: ...