summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tcejdb/ejdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tcejdb/ejdb.c b/tcejdb/ejdb.c
index e902816..0f936a0 100644
--- a/tcejdb/ejdb.c
+++ b/tcejdb/ejdb.c
@@ -3103,11 +3103,11 @@ static bool _qrypreprocess(EJCOLL *jcoll, EJQ *ejq, int qflags, EJQF **mqf,
ejq->skip = (uint32_t) ((v < 0) ? 0 : v);
}
bt = bson_find(&it, ejq->hints, "$max");
- if (BSON_IS_NUM_TYPE(bt)) {
+ if (qflags & JBQRYFINDONE) {
+ ejq->max = (uint32_t) 1;
+ } else if (BSON_IS_NUM_TYPE(bt)) {
int64_t v = bson_iterator_long(&it);
ejq->max = (uint32_t) ((v < 0) ? 0 : v);
- } else if (qflags & JBQRYFINDONE) {
- ejq->max = (uint32_t) 1;
}
if (!(qflags & JBQRYCOUNT)) {
bt = bson_find(&it, ejq->hints, "$fields"); //Collect required fields