Mongo Spark Connector, Update collection with Upsert

678 views
Skip to first unread message

Smit Dave

unread,
Aug 3, 2016, 7:06:52 PM8/3/16
to mongodb-user
Hello

I've been trying to update mongodb collection with native spark mongo connector with scala APIs.
i haven't been able to find any docs related to update with upsert.

let me know if you guys have done it, i'll be using it with spark streaming.

Ross Lawley

unread,
Aug 4, 2016, 3:54:21 AM8/4/16
to mongod...@googlegroups.com
Hi Smit,

Please see SPARK-66 which covers how to achieve this.  Basically, due to the collection being generic you will manually have to construct the upsert.  To be efficient it would be best to construct bulk updateMany calls per batch / partition.

Ross

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/6f32c392-dbd2-44e8-aebd-3df859e967dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


{ name     : "Ross Lawley",
  title    : "Senior Software Engineer",
  location : "London, UK",
  twitter  : ["@RossC0", "@MongoDB"],
  facebook :"MongoDB"}

Reply all
Reply to author
Forward
0 new messages