DATAMONGO-2153 - Polishing.

Relax name ordering in PersonAggregate as we're using unordered MongoDB set operations to assemble results.
This commit is contained in:
Mark Paluch
2019-05-21 12:11:28 +02:00
parent 60cb8c7de7
commit b01b25ef93

View File

@@ -17,8 +17,11 @@ package org.springframework.data.mongodb.repository;
import lombok.Value;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
@@ -31,12 +34,12 @@ import org.springframework.data.annotation.PersistenceConstructor;
class PersonAggregate {
@Id private String lastname;
private List<String> names;
private Set<String> names;
@PersistenceConstructor
public PersonAggregate(String lastname, List<String> names) {
public PersonAggregate(String lastname, Collection<String> names) {
this.lastname = lastname;
this.names = names;
this.names = new HashSet<>(names);
}
public PersonAggregate(String lastname, String name) {