skip to Main Content

How to update array of an object in mongodb?

Messages.update( {_id: docId, "messages.senderId": friendId}, { $set: {"messages.$[elem].read": true} }, { multi: true, arrayFilters: [{"elem.senderId": friendId}] }, (err, result) => { if (err) { return res.status(500).json({message: "Something error occured" + err}) } else { return res.status(200).json({message: "Successfully", result}) } }…

VIEW QUESTION

MongoDB Cannot run tests when building Docker image – Server selection error: server selection timeout

I'm running a mongo image in a container with this config: version: '3' services: mongodb: image: mongo ports: - '27017:27017' environment: - MONGO_INITDB_ROOT_USERNAME=user - MONGO_INITDB_ROOT_PASSWORD=password - MONGO_INITDB_DATABASE=microservices volumes: - ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro And I have started to build microservices with golang and…

VIEW QUESTION
Back To Top
Search