/** * Returns the total number of documents that match the query. */ public int countDocuments(JObject query, bool exactMatch) { JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager(); if (store == null) { throw new JSONStoreException(JSONStoreConstants.JSON_STORE_DATABASE_NOT_OPEN); } int countResult = 0; lock (JSONStore.lockThis) { if (query != null && query.HasValues) { countResult = store.countWithQuery(query, collectionName, exactMatch); } else { countResult = store.count(collectionName); } return(countResult); } }