Skip to content

Commit d40f191

Browse files
author
aman bansal
authored
chore: adding the delete via filters operation for document store (#86)
* chore: adding the delete via filters operation for document store
1 parent f38193f commit d40f191

File tree

5 files changed

+215
-26
lines changed

5 files changed

+215
-26
lines changed

document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreTest.java

Lines changed: 116 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,50 @@ public void testBulkUpsert(String dataStoreName) {
216216
assertEquals(5, collection.count());
217217
}
218218

219+
@ParameterizedTest
220+
@MethodSource("databaseContextProvider")
221+
public void testDeleteByDocFilter(String dataStoreName) {
222+
Datastore datastore = datastoreMap.get(dataStoreName);
223+
Collection collection = datastore.getCollection(COLLECTION_NAME);
224+
Map<Key, Document> bulkMap = new HashMap<>();
225+
bulkMap.put(new SingleValueKey("default", "testKey1"), Utils.createDocument("field", "value"));
226+
bulkMap.put(new SingleValueKey("default", "testKey2"), Utils.createDocument("field", "value"));
227+
bulkMap.put(new SingleValueKey("default", "testKey3"), Utils.createDocument("field", "value"));
228+
bulkMap.put(new SingleValueKey("default", "testKey4"), Utils.createDocument("field", "value"));
229+
bulkMap.put(new SingleValueKey("default", "testKey5"), Utils.createDocument("field", "value"));
230+
bulkMap.put(
231+
new SingleValueKey("default", "testKey6"),
232+
Utils.createDocument("email", "[email protected]"));
233+
234+
assertTrue(collection.bulkUpsert(bulkMap));
235+
236+
collection.delete(org.hypertrace.core.documentstore.Filter.eq("field", "value"));
237+
assertEquals(1, collection.count());
238+
}
239+
240+
@ParameterizedTest
241+
@MethodSource("databaseContextProvider")
242+
public void testDeleteByFilterUnsupportedOperationException(String dataStoreName) {
243+
Datastore datastore = datastoreMap.get(dataStoreName);
244+
Collection collection = datastore.getCollection(COLLECTION_NAME);
245+
Map<Key, Document> bulkMap = new HashMap<>();
246+
bulkMap.put(new SingleValueKey("default", "testKey1"), Utils.createDocument("field", "value"));
247+
bulkMap.put(new SingleValueKey("default", "testKey2"), Utils.createDocument("field", "value"));
248+
bulkMap.put(new SingleValueKey("default", "testKey3"), Utils.createDocument("field", "value"));
249+
bulkMap.put(new SingleValueKey("default", "testKey4"), Utils.createDocument("field", "value"));
250+
bulkMap.put(new SingleValueKey("default", "testKey5"), Utils.createDocument("field", "value"));
251+
bulkMap.put(
252+
new SingleValueKey("default", "testKey6"),
253+
Utils.createDocument("email", "[email protected]"));
254+
255+
assertTrue(collection.bulkUpsert(bulkMap));
256+
257+
UnsupportedOperationException exception =
258+
assertThrows(UnsupportedOperationException.class, () -> collection.delete((Filter) null));
259+
assertTrue(exception.getMessage().contains("Filter must be provided"));
260+
assertEquals(6, collection.count());
261+
}
262+
219263
@ParameterizedTest
220264
@MethodSource("databaseContextProvider")
221265
public void testWithDifferentFieldTypes(String dataStoreName) throws Exception {
@@ -612,14 +656,18 @@ public void testSubDocumentUpdate(String dataStoreName) throws IOException {
612656
Assertions.assertFalse(documents.isEmpty());
613657

614658
// mongo
615-
// {"_lastUpdateTime":{"$date":"2021-03-14T18:53:14.914Z"},"createdTime":1615747994870,"foo1":"bar1","lastUpdatedTime":1615747994920,"subdoc":{"subfoo1":"subbar1","nesteddoc":{"nestedfoo1":"nestedbar1"}}}
659+
// {"_lastUpdateTime":{"$date":"2021-03-14T18:53:14.914Z"},"createdTime":1615747994870,
660+
// "foo1":"bar1","lastUpdatedTime":1615747994920,"subdoc":{"subfoo1":"subbar1",
661+
// "nesteddoc":{"nestedfoo1":"nestedbar1"}}}
616662

617663
// postgres
618-
// {"foo1":"bar1","subdoc":{"subfoo1":"subbar1","nesteddoc":{"nestedfoo1":"nestedbar1"}},"created_at":"2021-03-15 00:24:50.981147","updated_at":"2021-03-15 00:24:50.981147"}
664+
// {"foo1":"bar1","subdoc":{"subfoo1":"subbar1","nesteddoc":{"nestedfoo1":"nestedbar1"}},
665+
// "created_at":"2021-03-15 00:24:50.981147","updated_at":"2021-03-15 00:24:50.981147"}
619666
System.out.println(documents.get(0).toJson());
620667
ObjectNode jsonNode = (ObjectNode) OBJECT_MAPPER.readTree(documents.get(0).toJson());
621668
String expected =
622-
"{\"foo1\":\"bar1\",\"subdoc\":{\"subfoo1\":\"subbar1\",\"nesteddoc\":{\"nestedfoo1\":\"nestedbar1\"}}}";
669+
"{\"foo1\":\"bar1\",\"subdoc\":{\"subfoo1\":\"subbar1\","
670+
+ "\"nesteddoc\":{\"nestedfoo1\":\"nestedbar1\"}}}";
623671
if (isMongo(dataStoreName)) {
624672
jsonNode.remove(MONGO_CREATED_TIME_KEY);
625673
jsonNode.remove(MONGO_LAST_UPDATE_TIME_KEY);
@@ -1044,7 +1092,13 @@ public void testSearchForNestedKey(String dataStoreName) throws IOException {
10441092
Datastore datastore = datastoreMap.get(dataStoreName);
10451093
Collection collection = datastore.getCollection(COLLECTION_NAME);
10461094
String documentString =
1047-
"{\"attributes\":{\"trace_id\":{\"value\":{\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1095+
"{\"attributes\":{\"trace_id\":{\"value\":{\"string\":\"00000000000000005e194fdf9fbf5101"
1096+
+ "\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1097+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1098+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1099+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1100+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1101+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
10481102
Document document = new JSONDocument(documentString);
10491103
SingleValueKey key = new SingleValueKey("default", "testKey1");
10501104
collection.upsert(key, document);
@@ -1067,19 +1121,42 @@ public void testSearch(String dataStoreName) throws IOException {
10671121
Datastore datastore = datastoreMap.get(dataStoreName);
10681122
Collection collection = datastore.getCollection(COLLECTION_NAME);
10691123
String docStr1 =
1070-
"{\"amount\":1234.5,\"testKeyExist\":null,\"attributes\":{\"trace_id\":{\"value\":{\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1124+
"{\"amount\":1234.5,\"testKeyExist\":null,"
1125+
+ "\"attributes\":{\"trace_id\":{\"value\":{\"string"
1126+
+ "\":\"00000000000000005e194fdf9fbf5101\"}},"
1127+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1128+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1129+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1130+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1131+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1132+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
10711133
Document document1 = new JSONDocument(docStr1);
10721134
SingleValueKey key1 = new SingleValueKey("default", "testKey1");
10731135
collection.upsert(key1, document1);
10741136

10751137
String docStr2 =
1076-
"{\"amount\":1234,\"testKeyExist\":123,\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":123,\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1138+
"{\"amount\":1234,\"testKeyExist\":123,"
1139+
+ "\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":123,"
1140+
+ "\"string\":\"00000000000000005e194fdf9fbf5101\"}},"
1141+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1142+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1143+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1144+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1145+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1146+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
10771147
Document document2 = new JSONDocument(docStr2);
10781148
SingleValueKey key2 = new SingleValueKey("default", "testKey2");
10791149
collection.upsert(key2, document2);
10801150

10811151
String docStr3 =
1082-
"{\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":null,\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1152+
"{\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":null,"
1153+
+ "\"string\":\"00000000000000005e194fdf9fbf5101\"}},"
1154+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1155+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1156+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1157+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1158+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1159+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
10831160
Document document3 = new JSONDocument(docStr3);
10841161
SingleValueKey key3 = new SingleValueKey("default", "testKey3");
10851162
collection.upsert(key3, document3);
@@ -1337,19 +1414,42 @@ public void testSearchIteratorInterface(String dataStoreName) throws IOException
13371414
Datastore datastore = datastoreMap.get(dataStoreName);
13381415
Collection collection = datastore.getCollection(COLLECTION_NAME);
13391416
String docStr1 =
1340-
"{\"amount\":1234.5,\"testKeyExist\":null,\"attributes\":{\"trace_id\":{\"value\":{\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1417+
"{\"amount\":1234.5,\"testKeyExist\":null,"
1418+
+ "\"attributes\":{\"trace_id\":{\"value\":{\"string"
1419+
+ "\":\"00000000000000005e194fdf9fbf5101\"}},"
1420+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1421+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1422+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1423+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1424+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1425+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
13411426
Document document1 = new JSONDocument(docStr1);
13421427
SingleValueKey key1 = new SingleValueKey("default", "testKey1");
13431428
collection.upsert(key1, document1);
13441429

13451430
String docStr2 =
1346-
"{\"amount\":1234,\"testKeyExist\":123,\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":123,\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1431+
"{\"amount\":1234,\"testKeyExist\":123,"
1432+
+ "\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":123,"
1433+
+ "\"string\":\"00000000000000005e194fdf9fbf5101\"}},"
1434+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1435+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1436+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1437+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1438+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1439+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
13471440
Document document2 = new JSONDocument(docStr2);
13481441
SingleValueKey key2 = new SingleValueKey("default", "testKey2");
13491442
collection.upsert(key2, document2);
13501443

13511444
String docStr3 =
1352-
"{\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":null,\"string\":\"00000000000000005e194fdf9fbf5101\"}},\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\",\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string\":\"driver\"}}},\"tenantId\":\"__default\"}";
1445+
"{\"attributes\":{\"trace_id\":{\"value\":{\"testKeyExistNested\":null,"
1446+
+ "\"string\":\"00000000000000005e194fdf9fbf5101\"}},"
1447+
+ "\"span_id\":{\"value\":{\"string\":\"6449f1f720c93a67\"}},"
1448+
+ "\"service_type\":{\"value\":{\"string\":\"JAEGER_SERVICE\"}},"
1449+
+ "\"FQN\":{\"value\":{\"string\":\"driver\"}}},"
1450+
+ "\"entityId\":\"e3ffc6f0-fc92-3a9c-9fa0-26269184d1aa\",\"entityName\":\"driver\","
1451+
+ "\"entityType\":\"SERVICE\",\"identifyingAttributes\":{\"FQN\":{\"value\":{\"string"
1452+
+ "\":\"driver\"}}},\"tenantId\":\"__default\"}";
13531453
Document document3 = new JSONDocument(docStr3);
13541454
SingleValueKey key3 = new SingleValueKey("default", "testKey3");
13551455
collection.upsert(key3, document3);
@@ -1379,7 +1479,9 @@ public void testSearchIteratorInterface(String dataStoreName) throws IOException
13791479
List<Document> documents = new ArrayList<>();
13801480
while (true) {
13811481
documents.add(results.next());
1382-
if (!results.hasNext()) break;
1482+
if (!results.hasNext()) {
1483+
break;
1484+
}
13831485
}
13841486
Assertions.assertEquals(1, documents.size());
13851487
}
@@ -1425,10 +1527,9 @@ private Map<String, List<CreateUpdateTestThread>> executeCreateUpdateThreads(
14251527
}
14261528

14271529
/**
1428-
* mongo
1429-
* {"_lastUpdateTime":{"$date":"2021-03-14T15:43:04.842Z"},"createdTime":1615736584763,"foo1":"bar1","lastUpdatedTime":1615736584763}
1430-
* postgres {"foo1":"bar1","created_at":"2021-03-14 21:20:00.178909","updated_at":"2021-03-14
1431-
* 21:20:00.178909"}
1530+
* mongo {"_lastUpdateTime":{"$date":"2021-03-14T15:43:04.842Z"},"createdTime":1615736584763,
1531+
* "foo1":"bar1","lastUpdatedTime":1615736584763} postgres {"foo1":"bar1","created_at":"2021-03-14
1532+
* 21:20:00.178909","updated_at":"2021-03-14 21:20:00.178909"}
14321533
*/
14331534
private static void verifyTimeRelatedFieldsPresent(String doc, String dataStoreName) {
14341535
if (isMongo(dataStoreName)) {

document-store/src/integrationTest/java/org/hypertrace/core/documentstore/mongo/MongoDocStoreTest.java

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import static org.junit.jupiter.api.Assertions.assertFalse;
88
import static org.junit.jupiter.api.Assertions.assertNotEquals;
99
import static org.junit.jupiter.api.Assertions.assertNotNull;
10+
import static org.junit.jupiter.api.Assertions.assertThrows;
1011
import static org.junit.jupiter.api.Assertions.assertTrue;
1112

1213
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -300,6 +301,39 @@ public void testSelectAll() throws IOException {
300301
assertEquals(1, collection.count());
301302
}
302303

304+
@Test
305+
public void testDeleteByFilter() throws IOException {
306+
datastore.createCollection(COLLECTION_NAME, null);
307+
Collection collection = datastore.getCollection(COLLECTION_NAME);
308+
collection.upsert(
309+
new SingleValueKey("default", "testKey1"), Utils.createDocument("field", "value"));
310+
collection.upsert(
311+
new SingleValueKey("default", "testKey2"), Utils.createDocument("field", "value"));
312+
collection.upsert(
313+
new SingleValueKey("default", "testKey3"), Utils.createDocument("field", "value1"));
314+
assertEquals(3, collection.count());
315+
// Delete one of the documents and test again.
316+
collection.delete(org.hypertrace.core.documentstore.Filter.eq("field", "value"));
317+
assertEquals(1, collection.count());
318+
}
319+
320+
@Test
321+
public void testDeleteByFilterUnsupportedOperation() throws IOException {
322+
datastore.createCollection(COLLECTION_NAME, null);
323+
Collection collection = datastore.getCollection(COLLECTION_NAME);
324+
collection.upsert(
325+
new SingleValueKey("default", "testKey1"), Utils.createDocument("field", "value"));
326+
collection.upsert(
327+
new SingleValueKey("default", "testKey2"), Utils.createDocument("field", "value"));
328+
collection.upsert(
329+
new SingleValueKey("default", "testKey3"), Utils.createDocument("field", "value1"));
330+
assertEquals(3, collection.count());
331+
UnsupportedOperationException exception =
332+
assertThrows(UnsupportedOperationException.class, () -> collection.delete((Filter) null));
333+
assertTrue(exception.getMessage().contains("Filter must be provided"));
334+
assertEquals(3, collection.count());
335+
}
336+
303337
@Test
304338
public void testSelections() throws IOException {
305339
datastore.createCollection(COLLECTION_NAME, null);
@@ -428,9 +462,9 @@ public void testReturnAndBulkUpsert() throws IOException {
428462
Map<Key, Document> documentMapV1 =
429463
Map.of(
430464
new SingleValueKey("default", "testKey1"),
431-
Utils.createDocument("id", "1", "testKey1", "abc-v1"),
465+
Utils.createDocument("id", "1", "testKey1", "abc-v1"),
432466
new SingleValueKey("default", "testKey2"),
433-
Utils.createDocument("id", "2", "testKey2", "xyz-v1"));
467+
Utils.createDocument("id", "2", "testKey2", "xyz-v1"));
434468

435469
Iterator<Document> iterator = collection.bulkUpsertAndReturnOlderDocuments(documentMapV1);
436470
// Initially there shouldn't be any documents.
@@ -440,9 +474,9 @@ public void testReturnAndBulkUpsert() throws IOException {
440474
Map<Key, Document> documentMapV2 =
441475
Map.of(
442476
new SingleValueKey("default", "testKey1"),
443-
Utils.createDocument("id", "1", "testKey1", "abc-v2"),
477+
Utils.createDocument("id", "1", "testKey1", "abc-v2"),
444478
new SingleValueKey("default", "testKey2"),
445-
Utils.createDocument("id", "2", "testKey2", "xyz-v2"));
479+
Utils.createDocument("id", "2", "testKey2", "xyz-v2"));
446480
iterator = collection.bulkUpsertAndReturnOlderDocuments(documentMapV2);
447481
assertEquals(2, collection.count());
448482
List<Document> documents = new ArrayList<>();

document-store/src/main/java/org/hypertrace/core/documentstore/Collection.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ public interface Collection {
8888
*/
8989
boolean delete(Key key);
9090

91+
/**
92+
* Delete the document matching the given filter.
93+
*
94+
* @param filter The filter to determine documents to be deleted. Only the filter clause.
95+
* @return True if the documents are deleted, false otherwise.
96+
*/
97+
boolean delete(Filter filter);
98+
9199
/**
92100
* Delete the documents for the given keys
93101
*

0 commit comments

Comments
 (0)