skip to Main Content

MongoDB/Mongoose : CastError in updateMany $inc

My MongoDB schema (simplified): user: ObjectID calories: Number meals:[{ calories: Number name:String }] And I have a updateMany query: await Meals.updateMany( { user: user, 'meals.name': extraMealName }, { $inc: { calories: 'meals.$.calories' } }, {multi : true}, function(error, result) {…

VIEW QUESTION

Mongodb – Failed to execute CommandLineRunner

I have a spring boot application that has been up running for months now. Everything was fine until I added this line in the UserRepository that extends MongoRepository: List<User> findAllByUserName(List<String> usernames); Now I get the following error: java.lang.IllegalStateException: Failed to…

VIEW QUESTION

Mongodb and Gridfs file download

I'm building an application that allows the user to upload and download files. The issue i'm currently having is that I can retrieve the file from my MongoDB database and download it locally through my machine, but I can't get…

VIEW QUESTION

MongoDB Join Fields Aggregation

In MongoDB, I have a collection of different movies with their years. Consider these documents: { "_id" : ObjectId("63a994974ac549c5ea982d2b"), "title" : "Destroyer", "year" : 1907 }, { "_id" : ObjectId("63a994974ac549c5ea982d2a"), "title" : "Aquaman", "year" : 1902 }, { "_id" :…

VIEW QUESTION
Back To Top
Search