/** * Stores data as documents in the collection. */ public int remove(JArray documents, JSONStoreRemoveOptions options) { // get the shared manager JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager(); if (store == null) { //JSONStoreLoggerError(@"Error: JSON_STORE_DATABASE_NOT_OPEN, code: %d", rc); throw new JSONStoreException(JSONStoreConstants.JSON_STORE_DATABASE_NOT_OPEN); } int numUpdated = 0; JArray failures = new JArray(); // loop through each document to remove lock (JSONStore.lockThis) { foreach (JToken document in documents) { int lastUpdatedNum = 0; lastUpdatedNum = store.remove(document, collectionName, !options.isErase, options.exact); if (lastUpdatedNum < 0) { // store the failure failures.Add(document); } else { // sucess, update the count numUpdated += lastUpdatedNum; } } // if failures, return each if (failures.Count > 0) { //JSONStoreLoggerError(@"Error: JSON_STORE_REMOVE_WITH_QUERIES_FAILURE, code: %d, collection name: %@, accessor username: %@, failures count: %d, query failures: %@", rc, self.collectionName, accessor != nil ? accessor.username : @"nil", [failures count], failures); throw new JSONStoreException(JSONStoreConstants.JSON_STORE_REMOVE_WITH_QUERIES_FAILURE, failures); } return(numUpdated); } }