]> gitweb.factorcode.org Git - factor.git/commitdiff
fixed collection problem (query)
authorSascha Matzke <sascha@tetsuo.local>
Fri, 24 Apr 2009 07:32:00 +0000 (09:32 +0200)
committerSascha Matzke <sascha@tetsuo.local>
Fri, 24 Apr 2009 07:32:00 +0000 (09:32 +0200)
mongodb/driver/driver.factor

index 02b2f1b7c8e6600896f700dc3f7e70828d4d1aef..d488dcc872a68c7ea398bfb5324e99ec24067474 100644 (file)
@@ -120,6 +120,9 @@ MEMO: check-collection ( collection -- fq-collection )
     [ [ (ensure-collection) ] keep ] unless
     [ mdb-instance name>> ] dip "%s.%s" sprintf ; inline
 
+: fix-query-collection ( mdb-query -- mdb-query )
+    [ check-collection ] change-collection ; inline
+    
 PRIVATE>
 
 : <query> ( collection query -- mdb-query )
@@ -151,7 +154,7 @@ M: mdb-cursor get-more ( mdb-cursor -- mdb-cursor objects )
 
 GENERIC: find ( mdb-query -- cursor result )
 M: mdb-query-msg find
-    send-query ;
+    fix-query-collection send-query ;
 M: mdb-cursor find
     get-more ;
 
@@ -161,6 +164,7 @@ M: mdb-query-msg explain.
 
 GENERIC: find-one ( mdb-query -- result/f )
 M: mdb-query-msg find-one
+    fix-query-collection 
     1 >>return# send-query-plain objects>>
     dup empty? [ drop f ] [ first ] if ;