Search in sources :

Example 1 with PersonWithConvertedId

use of org.springframework.data.mongodb.core.MongoTemplateTests.PersonWithConvertedId in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplateTests method removesObjectFromExplicitCollection.

// DATAMONGO-1444
@Test
void removesObjectFromExplicitCollection() {
    String collectionName = "explicit";
    template.remove(new Query(), collectionName).as(StepVerifier::create).expectNextCount(1).verifyComplete();
    PersonWithConvertedId person = new PersonWithConvertedId();
    person.name = "Dave";
    // 
    template.save(person, collectionName).as(// 
    StepVerifier::create).expectNextCount(// 
    1).verifyComplete();
    // 
    template.findAll(PersonWithConvertedId.class, collectionName).as(// 
    StepVerifier::create).expectNextCount(1).verifyComplete();
    template.remove(person, collectionName).as(StepVerifier::create).expectNextCount(1).verifyComplete();
    template.findAll(PersonWithConvertedId.class, collectionName).as(StepVerifier::create).verifyComplete();
}
Also used : NearQuery(org.springframework.data.mongodb.core.query.NearQuery) Query(org.springframework.data.mongodb.core.query.Query) PersonWithConvertedId(org.springframework.data.mongodb.core.MongoTemplateTests.PersonWithConvertedId) StepVerifier(reactor.test.StepVerifier) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 PersonWithConvertedId (org.springframework.data.mongodb.core.MongoTemplateTests.PersonWithConvertedId)1 NearQuery (org.springframework.data.mongodb.core.query.NearQuery)1 Query (org.springframework.data.mongodb.core.query.Query)1 StepVerifier (reactor.test.StepVerifier)1