diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java index cf0d696ef..b00ca61a3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java @@ -98,7 +98,7 @@ public class SimpleMongoRepository implements MongoRepository { Assert.notNull(entities, "The given Iterable of entities not be null!"); Streamable source = Streamable.of(entities); - boolean allNew = source.stream().allMatch(it -> entityInformation.isNew(it)); + boolean allNew = source.stream().allMatch(entityInformation::isNew); if (allNew) { @@ -212,6 +212,8 @@ public class SimpleMongoRepository implements MongoRepository { @Override public Iterable findAllById(Iterable ids) { + Assert.notNull(ids, "The given Ids of entities not be null!"); + return findAll(new Query(new Criteria(entityInformation.getIdAttribute()) .in(Streamable.of(ids).stream().collect(StreamUtils.toUnmodifiableList())))); }