diff options
author | adam <adamansky@gmail.com> | 2013-06-19 09:49:00 +0700 |
---|---|---|
committer | adam <adamansky@gmail.com> | 2013-06-19 09:49:00 +0700 |
commit | 15d9c900d1d2c1bf69fa2034afa344971c4de6f0 (patch) | |
tree | 33dbcb83a108cd43ad53beaa211bc3aed57bccbf | |
parent | 65961ed407a3d5614df40d1812e6331429c3729a (diff) | |
download | ejdb-15d9c900d1d2c1bf69fa2034afa344971c4de6f0.tar.gz ejdb-15d9c900d1d2c1bf69fa2034afa344971c4de6f0.tar.bz2 ejdb-15d9c900d1d2c1bf69fa2034afa344971c4de6f0.zip |
#24
-rw-r--r-- | tcejdb/ejdb.c | 6 |
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 |