Skip to content

Conversation

rubenjgarcia
Copy link
Contributor

  • You have read the Spring Data contribution guidelines.
  • There is a ticket in the bug tracker for the project in our JIRA.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your pull request. It looks good overall. I left comments on some minor issue. Care to take a look?


Example<ReactivePerson> example = Example.of(new ReactivePerson("foo", "bar", -1));

StepVerifier.create(repository.findOne(example)).expectNextCount(0).verifyComplete();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.expectNextCount(0) can be omitted and simplified to StepVerifier.create(repository.findOne(example)).verifyComplete();

}
return Mono.just(vals.iterator().next());
}).single();
}).singleOrEmpty();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use .next() here. We've already covered the case if there's more than one element.

@mp911de mp911de changed the title DATAMONGO-1907 DATAMONGO-1907 - Do not throw an exception in ReactiveQueryByExampleExecutor.findOne() on empty result Mar 21, 2018
@mp911de
Copy link
Member

mp911de commented Mar 21, 2018

Awesome. I'll take the pull request from here.

mp911de pushed a commit that referenced this pull request Mar 21, 2018
…omplete without exception on empty result We now no longer emit an exception via SimpleReactiveMongoRepository.findOne(Example) if the query completes without yielding a result. Previously findOne(Example) emitted a NoSuchElementException if the query returned no result. Original pull request: #541.
mp911de added a commit that referenced this pull request Mar 21, 2018
Rename test method to reflect test subject. Switch from flatMap(…) to map(…) to avoid overhead of Mono creation. Original pull request: #541.
mp911de pushed a commit that referenced this pull request Mar 21, 2018
…omplete without exception on empty result We now no longer emit an exception via SimpleReactiveMongoRepository.findOne(Example) if the query completes without yielding a result. Previously findOne(Example) emitted a NoSuchElementException if the query returned no result. Original pull request: #541.
mp911de added a commit that referenced this pull request Mar 21, 2018
Rename test method to reflect test subject. Switch from flatMap(…) to map(…) to avoid overhead of Mono creation. Original pull request: #541.
@mp911de
Copy link
Member

mp911de commented Mar 21, 2018

That's merged, polished and backported now.

@mp911de mp911de closed this Mar 21, 2018
hlang pushed a commit to hlang/spring-data-mongodb that referenced this pull request Mar 23, 2018
…omplete without exception on empty result We now no longer emit an exception via SimpleReactiveMongoRepository.findOne(Example) if the query completes without yielding a result. Previously findOne(Example) emitted a NoSuchElementException if the query returned no result. Original pull request: spring-projects#541.
hlang pushed a commit to hlang/spring-data-mongodb that referenced this pull request Mar 23, 2018
Rename test method to reflect test subject. Switch from flatMap(…) to map(…) to avoid overhead of Mono creation. Original pull request: spring-projects#541.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants