bsoneach v0.4.1 BSONEach.Stream

This module creates stream of Elixir structures from a BSON file with one or many documents.

Summary

Functions

Create a documents stream from batch to BSON file

Functions

resource(path, on_corrupted \\ :stop)
resource(Path.t, atom) :: Enum.t

Create a documents stream from batch to BSON file.

You can define different strategies when dealing with corrupted documents:

  • :stop - stop stream when corrupted document is found.
  • :skip - try to skip corrupted documents and continue reading file. Warning: this option can have performance issues, since there will be up to file_size/4 reads from corrupted file. Also, Enum length will not correspond to real documents count.
  • :report - same as :skip but errors with their reasons will be returned as Stream elements.