0

I wanna ask if you can insert some NEW data to an existing User,

Without adding them from before but only by defining them in the model.

Is that possible and if yes how?

Please let me know if you didn't understand any part of this.

3
  • mongo supports upsert functionality. Can you please post some code as to what you have tried? Commented Apr 30, 2020 at 11:58
  • I haven't tried anything cause i didn't know if that was possible. Commented Apr 30, 2020 at 12:00
  • @akaphenom I just searched that. Do you mean with the update function? Commented Apr 30, 2020 at 12:02

1 Answer 1

2

https://docs.mongodb.com/manual/reference/method/db.collection.update/

mongodb.someCollection.update(
  {/* some query to match the record or not */},
  {/* record to update OR record to insert if no match */},
  {
     /* options */
     upsert: true
  }
)
Sign up to request clarification or add additional context in comments.

1 Comment

I think that's what i want it to do yeah. Thanks a lot i think this going to work for me HUGE Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.