Skip to content

Instantly share code, notes, and snippets.

@bszwej
Last active July 31, 2017 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bszwej/26e2c996d7e179ab871e74fd916ea039 to your computer and use it in GitHub Desktop.
Save bszwej/26e2c996d7e179ab871e74fd916ea039 to your computer and use it in GitHub Desktop.
Source.fromPublisher(collection.find(): Publisher[org.bson.Document])
.map((doc: org.bson.Document) ⇒ doc.toJson())
.map((json: String) ⇒ ByteString(json))
.runWith(s3Sink)
val s3Sink: Sink[ByteString, Future[MultipartUploadResult]] =
s3Client.multipartUpload(
bucket = "bucketWithCookies",
key = "CookieCollectionBackup.json"
)
The full runnable code can be found here:
https://github.com/bszwej/mongodb-s3-stream-example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment