 
 PRIVATE>
 
-: stream>assoc ( exemplar -- assoc )
+: stream>assoc ( exemplar -- assoc/f )
     clone [
         state [ bson-object-data-read ] with-variable
-    ] keep ;
+    ] keep swap [ drop f ] unless ;
+
+: path>bson-sequence ( path -- assoc )
+    binary [
+        [ H{ } stream>assoc ] loop>array
+    ] with-file-reader ;

! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs bson.constants calendar combinators
combinators.short-circuit io io.binary kernel math locals
io.encodings.utf8 io.encodings
namespaces sequences serialize strings vectors byte-arrays ;

FROM: io.encodings.binary => binary ;

        [ clear-assoc ] [ ] [ ] tri state
    ] dip with-variable ; inline

: bson-object-data-read ( -- ? )
    read-int32 [ f ] [ drop read-elements t ] if-zero ; inline recursive

: bson-binary-read ( -- binary )
   read-int32 read-byte 
