@@ -441,18 +441,27 @@ public String[] query_id(Query queryClause, String orderByStr, int offset, int l
441441 return GenericConvert .toStringArray (ret );
442442 }
443443
444- // /**
445- // * Performs a search query, and returns the respective DataObjects
446- // *
447- // * @param where query statement
448- // * @param where clause values array
449- // *
450- // * @returns The total count for the query
451- // */
452- // @Override
453- // public long queryCount(String whereClause, Object[] whereValues) {
454- // return queryBuilder.dataObjectMapCount(whereClause, whereValues, null, -1, -1);
455- // }
444+ /**
445+ * Performs a search query, and returns the respective DataObjects
446+ *
447+ * @param where query statement
448+ * @param where clause values array
449+ *
450+ * @returns The total count for the query
451+ */
452+ @ Override
453+ public long queryCount (String whereClause , Object [] whereValues ) {
454+ // return collection count, if there is no where clause
455+ if ( whereClause == null ) {
456+ return collection .countDocuments ();
457+ }
458+
459+ // The query filter to use, use "all" if queryClause is null
460+ Bson bsonFilter = queryObjToBsonFilter (Query .build (whereClause , whereValues ));
461+
462+ // Perform the query and count
463+ return collection .countDocuments (bsonFilter );
464+ }
456465
457466 //--------------------------------------------------------------------------
458467 //
0 commit comments