removed findOne words, added new word nfind ( example n -- result ) which limits the number of results returned to n
parent
0cbd1ed207
commit
eb00f33fa8
|
@ -8,7 +8,7 @@ IN: mongodb
|
||||||
! generic methods
|
! generic methods
|
||||||
GENERIC: store ( tuple/ht -- )
|
GENERIC: store ( tuple/ht -- )
|
||||||
GENERIC: find ( example -- tuple/ht )
|
GENERIC: find ( example -- tuple/ht )
|
||||||
GENERIC: findOne ( exampe -- tuple/ht )
|
GENERIC# nfind 1 ( example n -- tuple/ht )
|
||||||
GENERIC: load ( object -- object )
|
GENERIC: load ( object -- object )
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
@ -34,9 +34,9 @@ M: mdb-persistent find ( example -- result )
|
||||||
prepare-find [ mdb>> master>> ] dip (find)
|
prepare-find [ mdb>> master>> ] dip (find)
|
||||||
build-result ;
|
build-result ;
|
||||||
|
|
||||||
M: mdb-persistent findOne ( example -- result )
|
M: mdb-persistent nfind ( example n -- result )
|
||||||
prepare-find [ mdb>> master>> ] dip (find-one)
|
[ prepare-find ] dip >>return#
|
||||||
dup returned#>> 1 =
|
[ mdb>> master>> ] dip (find)
|
||||||
[ objects>> first ]
|
build-result ;
|
||||||
[ drop f ] if ;
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue