skip to Main Content

Mongodb – How to update some collection with different query parameters and with different set values?

I have an array of mongoDB collection - [ { "_id": "630499244683ed43d56edd06", "userId": "630499234683ed43d56edd05", "isPaid": "true" }, { "_id": "6304c19bda84477b41b4bbfa", "userId": "630499234683ed43d56edd05", "isPaid": "true" }, { "_id": "6304c1b5da84477b41b4bbfb", "userId": "630499234683ed43d56edd05", "isPaid": "true" }, { "_id": "6304c1cbda84477b41b4bbfc", "userId": "630499234683ed43d56edd05", "isPaid": "true"…

VIEW QUESTION

Mongodb – get does not return the data in express

I'm working with a simple GET request but it returns nothing in the browser with no warnings. I checked all the connections to Mongoose works perfectly and collection name are correct. const uriAtlas = "mongodb://localhost:27017/appfullMern"; mongoose.connect(uriAtlas).then(() => console.log("successful connexion DB")…

VIEW QUESTION

Mongodb – Extract list of data from collections

I have a list of collection like the following in mongodb { _id: ObjectId("6087feeef467a4320883daf3"), name: 'group 1', admins: ['adam', 'ken'] } { _id: ObjectId("2087feeef467a4320883daf3"), name: 'group 2', admins: ['rebecca'] } { _id: ObjectId("9987feeef467a4320883daf3"), name: 'group 3', admins: [] } I…

VIEW QUESTION

MongoDB Unrecognized expression '$replaceOne'

I'm trying to run a query to replace a few pattern in my collection: db.collection.updateMany({ lastImageUrl: { "$regex": "kidplus-bucket-eu" } }, [ { $set: { videos: { high: { videoUrl: { $replaceOne: { input: "$lastImageUrl", find: "/kidplus-bucket-eu", replacement: "/kidplus-bucket-demo" }…

VIEW QUESTION
Back To Top
Search