Mongo Streams provides syntax to build sink that writes to mongo filesystem. Syntax can define to what file data has to be
written, what can be chunk-size and what metadata should be associated with file.
File syntax creates file reference that indicates where the file has to be saved and with which data.
Following syntax is available:
foo
file("foo")
foo
with supplied Id file("foo", id = new ObjectId)
foo
with MIME content type file("foo", contentType = Some("text/plain; charset=UTF-8"))
foo
with supplied size of chunk file("foo", chunkSize = 1024)
File named foo
with supplied metadata file("foo", meta = Some(BSONObject("user" -> "luke")))
Writing single file is easy simple syntax. Writing operation does not modify supplied Bytes object, therefore the
Bytes object may be recycled for better efficiency
source10k to (filesystem(fileDb) using (write file ("foo.txt")))
Total for specification FSWriteSpec | |
---|---|
Finished in | 1 second, 325 ms |
Results | 1 example, 0 failure, 0 error |