Skip to content

Commit 93a14ea

Browse files
committed
Distinguish Query Hint and Order field types
1 parent 95d3507 commit 93a14ea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Database/MongoDB/Query.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ data Query = Query {
12451245
sort :: Order, -- ^ Sort results by this order, @[]@ = no sort. Default = @[]@
12461246
snapshot :: Bool, -- ^ Deprecated since MongoDB 4.0. If true assures no duplicates are returned, or objects missed, which were present at both the start and end of the query's execution (even if the object were updated). If an object is new during the query, or deleted during the query, it may or may not be returned, even with snapshot mode. Note that short query responses (less than 1MB) are always effectively snapshotted. Default = @False@
12471247
batchSize :: BatchSize, -- ^ The number of document to return in each batch response from the server. 0 means use Mongo default. Default = 0
1248-
hint :: Order -- ^ Force MongoDB to use this index, @[]@ = no hint. Default = @[]@
1248+
hint :: Hint -- ^ Force MongoDB to use this index, @[]@ = no hint. Default = @[]@
12491249
} deriving (Show, Eq)
12501250

12511251
type Projector = Document
@@ -1257,6 +1257,11 @@ type Limit = Word32
12571257
type Order = Document
12581258
-- ^ Fields to sort by. Each one is associated with 1 or -1. Eg. @[\"x\" =: 1, \"y\" =: -1]@ means sort by @x@ ascending then @y@ descending
12591259

1260+
-- The current specification allows this to be passed as a string or a document. For backwards compatibility and simplicity, I'm leaving this unchanged to continue being required as a document.
1261+
-- https://github.com/mongodb/specifications/blob/e651ebe819743f1cffae938f5488c69d5277c21f/source/crud/crud.md?plain=1#L1953
1262+
type Hint = Document
1263+
-- ^ Index specification. If specified, then the query system will only consider plans using the hinted index. Specify the index name as a key pattern, e.g. { age: 1 }
1264+
12601265
type BatchSize = Word32
12611266
-- ^ The number of document to return in each batch response from the server. 0 means use Mongo default.
12621267

0 commit comments

Comments
 (0)