 : drop-collection ( name -- )
     [ cmd-collection ] dip
     "drop" H{ } clone [ set-at ] keep
-    <mdb-query-msg> find-one objects>> first check-ok
+    <mdb-query-msg> find-one check-ok
     [ "could not drop collection" throw ] unless ;

M: assoc count
    [ "count" H{ } clone [ set-at ] keep ] dip
    [ over [ "query" ] dip set-at ] when*
    [ cmd-collection ] dip <mdb-query-msg> find-one objects>> first
    [ check-ok ] keep '[ "n" _ at >fixnum ] [ f ] if ;
 
: lasterror ( -- error )
    cmd-collection H{ { "getlasterror" 1 } } <mdb-query-msg>
    find-one objects>> first [ "err" ] dip at ;

GENERIC: validate. ( collection -- )
M: string validate.
    [ cmd-collection ] dip
    "validate" H{ } clone [ set-at ] keep
    <mdb-query-msg> find-one objects>> first [ check-ok ] keep
    '[ "result" _ at print ] when ;
M: mdb-collection validate.
    name>> validate. ;

    H{ } clone
    [ [ "index" ] dip set-at ] keep
    [ [ "deleteIndexes" ] dip set-at ] keep
    [ cmd-collection ] dip <mdb-query-msg> find-one 
    check-ok [ "could not drop index" throw ] unless ;

: <update> ( collection selector object -- update-msg )
