 
 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 ;

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

: bson-object-data-read ( -- )
    read-int32 drop read-elements ; inline recursive

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

        { T_Integer     [ read-int32 ] }
        { T_Integer64   [ read-longlong ] }
        { T_Binary      [ bson-binary-read ] }
        { T_Object      [ [ bson-object-data-read drop ] object-result check-object ] }
        { T_Array       [ [ bson-object-data-read drop ] object-result values ] }
        { T_Double      [ read-double ] }
        { T_Boolean     [ read-byte 1 = ] }
        { T_Date        [ read-longlong millis>timestamp ] }
