/**
         * Locates documents inside a collection that matches the query.
         */
        public JArray findWithQueries(JArray queries, JSONStoreQueryOptions options)
        {
            if (options.offset > 0 && options.limit <= 0)
            {
                //JSONStoreLoggerError(@"Error: JSON_STORE_INVALID_OFFSET, code: %d", rc);
                throw new JSONStoreException(JSONStoreConstants.JSON_STORE_INVALID_OFFSET);
            }

            JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager();

            if (store == null)
            {
                throw new JSONStoreException(JSONStoreConstants.JSON_STORE_DATABASE_NOT_OPEN);
            }

            List <string> ids            = new List <string>();
            List <string> jObjectStrings = new List <string>();
            JArray        fullResults    = new JArray();

            lock (JSONStore.lockThis)
            {
                foreach (JToken currentQuery in queries)
                {
                    JArray results = store.find(currentQuery, collectionName, options);

                    if (results != null)
                    {
                        foreach (JObject result in results)
                        {
                            JToken value;
                            if (!result.TryGetValue("_id", out value))
                            {
                                if (!jObjectStrings.Contains(result.ToString()))
                                {
                                    fullResults.Add(result);
                                    jObjectStrings.Add(result.ToString());
                                }
                            }
                            else if (!ids.Contains(value.ToString()))
                            {
                                fullResults.Add(result);
                                ids.Add(value.ToString());
                            }
                        }
                    }
                    else
                    {
                        fullResults = null;

                        //A find failed, break and go to the error callback
                        break;
                    }
                }

                // If we get back a nil array, then the SQL statment was invalid or the database was closed.
                // If we just didn't find anything for a valid SQL statement, then we get back a non-nil empty array.
                if (fullResults == null)
                {
                    //JSONStoreLoggerError(@"Error: JSON_STORE_INVALID_SEARCH_FIELD, code: %d, collection name: %@, accessor username: %@, currentQuery: %@, JSONStoreQueryOptions: %@", rc, self.collectionName, accessor != nil ? accessor.username : @"nil", lastQuery, options);
                    throw new JSONStoreException(JSONStoreConstants.JSON_STORE_INVALID_SEARCH_FIELD);
                }

                return(fullResults);
            }
        }