USING: accessors assocs fry io.encodings.binary io.sockets kernel math math.parser namespaces sequences splitting mongodb.connection mongodb.persistent mongodb.msg mongodb.query mongodb.tuple ; IN: mongodb ! generic methods GENERIC: store ( tuple/ht -- ) GENERIC: find ( example -- tuple/ht ) GENERIC# nfind 1 ( example n -- tuple/ht ) GENERIC: load ( object -- object ) > get-collection-fqn ] keep H{ } tuple>query ; inline PRIVATE> : ( db host port -- mdb ) () ; M: mdb-persistent store ( tuple -- ) prepare-store ! H { collection { ... values ... } [ [ get-collection-fqn ] dip values [ mdb>> master>> binary ] dip '[ _ write-message ] with-client ] assoc-each ; M: mdb-persistent find ( example -- result ) prepare-find [ mdb>> master>> ] dip (find) build-result ; M: mdb-persistent nfind ( example n -- result ) [ prepare-find ] dip >>return# [ mdb>> master>> ] dip (find) build-result ;