@@ -133,7 +133,7 @@ import Database.MongoDB.Internal.Protocol
133133 )
134134import Control.Monad.Trans.Except
135135import qualified Database.MongoDB.Internal.Protocol as P
136- import Database.MongoDB.Internal.Util (liftIOE , loop , true1 , (<.>) )
136+ import Database.MongoDB.Internal.Util (liftIOE , loop , true1 , (<.>) , splitDot )
137137import System.Mem.Weak (Weak )
138138import Text.Read (readMaybe )
139139import Prelude hiding (lookup )
@@ -1273,7 +1273,7 @@ find q@Query{selection, batchSize} = do
12731273 let newQr =
12741274 case fst qr of
12751275 Req qry ->
1276- let coll = last $ T. splitOn " . " (qFullCollection qry)
1276+ let (_db, coll) = splitDot (qFullCollection qry)
12771277 in (Req $ qry {qSelector = merge (qSelector qry) [ " find" =: coll ]}, snd qr)
12781278 -- queryRequestOpMsg only returns Cmd types constructed via Req
12791279 _ -> error " impossible"
@@ -1333,7 +1333,7 @@ findOne q = do
13331333 let newQr =
13341334 case fst qr of
13351335 Req qry ->
1336- let coll = last $ T. splitOn " . " (qFullCollection qry)
1336+ let (_db, coll) = splitDot (qFullCollection qry)
13371337 -- We have to understand whether findOne is called as
13381338 -- command directly. This is necessary since findOne is used via
13391339 -- runCommand as a vehicle to execute any type of commands and notices.
0 commit comments