Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,27 @@ class CoroutineMongoRepositoryIntSpec extends Specification {
ENTITY_ID | true
"abcd" | false
}

def "should delete entities by collection"() {
given:
def entity2 = new TestEntity()
entity2.id = "id-2"
def entity3 = new TestEntity()
entity3.id = "id-3"
runBlocking { cont ->
testRepository.saveAll([entity2, entity3], cont)
}

when:
runBlocking { cont ->
testRepository.deleteAll([entity3], cont)
}

then:
def result = runBlocking { cont ->
testRepository.findAll(cont)
}

result.size() == 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ open class SimpleCoroutineMongoRepository<T, ID: Serializable>(
}

override suspend fun deleteAll(entities: Iterable<T>) {
reactiveRepo.deleteAll().awaitFirstOrDefault(null)
reactiveRepo.deleteAll(entities).awaitFirstOrDefault(null)
}

override suspend fun <S : T> insert(entity: S): S? =
Expand Down