     [ [ (ensure-collection) ] keep ] unless
     [ mdb-instance name>> ] dip "%s.%s" sprintf ; inline
 
+PRIVATE>
+
 : <query> ( collection query -- mdb-query )
-    [ ensure-collection ] dip
     <mdb-query-msg> ; inline
 
 GENERIC# limit 1 ( mdb-query limit# -- mdb-query )


GENERIC: save ( collection assoc -- )
M: assoc save
    [ ensure-collection ] dip
    <mdb-insert-msg> send-message-check-error ;

GENERIC: save-unsafe ( collection object -- )
M: assoc save-unsafe
    [ ensure-collection ] dip
    <mdb-insert-msg> send-message ;

GENERIC: ensure-index ( collection name spec -- )

MEMO: reserved-namespace? ( name -- ? )
    [ "$cmd" = ] [ "system" head? ] bi or ;
    
MEMO: check-collection ( collection -- fq-collection )
    dup mdb-collection? [ name>> ] when
    "." split1 over mdb-instance name>> =
    [ nip ] [ drop ] if
