     V{ } clone >>cursors
     [ [ cursors#>> ] keep 
       '[ read-longlong _ cursors>> push ] times ] keep ;
+
+M: mdb-update-op (read-message) ( msg-stub opcode -- message )
+    drop
+    [ mdb-update-msg new ] dip copy-header
+    read-cstring >>collection
+    read-int32 >>upsert?
+    H{ } stream>assoc change-bytes-read >>selector
+    H{ } stream>assoc change-bytes-read >>object ;
 
 M: mdb-reply-op (read-message) ( msg-stub opcode -- message )
     drop

       objects>> [ assoc>array write ] each
    ] (write-message) ;

M: mdb-delete-msg write-message ( message -- )
    dup
    '[ _

    [ >>collection ] dip
    >>objects OP_Insert >>opcode ;

: <mdb-update-msg> ( collection object -- mdb-update-msg )
    [ mdb-update-msg new ] 2dip
    [ >>collection ] dip
    [ [ "_id" ] dip at "_id" H{ } clone [ set-at ] keep >>selector ] keep
    >>object OP_Update >>opcode ;
    
: <mdb-reply-msg> ( -- mdb-reply-msg )
    mdb-reply-msg new ; inline

