Skip to main content

All Questions

0 votes
1 answer
36 views

problems to update mongodb collection

so I have two different collections for my social media app. One for the users and the other one for the user's posts. Whenever I'm updating the info from one of my user's collection it should also ...
dylanb15's user avatar
0 votes
1 answer
685 views

Mongoose adding product to Cart products array

I've been trying to figure out how to push new product to existing cart which I have in my database. updateOne is searching for a a cart with claimed userId and then ties to insert new product into ...
Johnn's user avatar
  • 57
1 vote
1 answer
3k views

how do I fix this problem I'm having with findOneAndUpdate

Trying to update mongodb doc using findOneAndUpdate method tried looking up the doc in various ways and reformating the update in different ways router.put( "/edit", [ auth, [ ...
Ggd Hhdhd's user avatar
  • 145
0 votes
1 answer
241 views

Right usage of MongoDB update functions in Javascript

I have a probably simple problem using the MongoDB API for updating a document. I have tried several things but nothing was successful. Inserting and deleting in contrast work fine. So what am I ...
user2442635's user avatar
0 votes
2 answers
5k views

Update a field, depending on another field, in MongoDB documents (with Mongoose in Node.js)

I have a collection named Article in MongoDB database, with the following schema and model: var articleSchema = new Schema({ site: String, date: String, day: String, link: { type: ...
GBC's user avatar
  • 345
12 votes
3 answers
27k views

Add a field to existing MongoDB document (with Mongoose in Node.js)

I have this existing document in a collection Article in MongoDB database: [ { site: 'www.atlantico.fr', date: '2014-05-27T11:10:19.000Z', link: 'http://www.atlantico.fr/example.html', _id: ...
GBC's user avatar
  • 345