use of org.springframework.data.mongodb.repository.Person in project spring-data-mongodb by spring-projects.
the class AggregationTests method createUsersWithReferencedPersons.
private void createUsersWithReferencedPersons() {
mongoTemplate.dropCollection(User.class);
mongoTemplate.dropCollection(Person.class);
User user1 = new User("u1");
User user2 = new User("u2");
User user3 = new User("u3");
mongoTemplate.save(user1);
mongoTemplate.save(user2);
mongoTemplate.save(user3);
Person person1 = new Person("u1", "User 1");
Person person2 = new Person("u2", "User 2");
mongoTemplate.save(person1);
mongoTemplate.save(person2);
mongoTemplate.save(user3);
}
use of org.springframework.data.mongodb.repository.Person in project spring-data-mongodb by spring-projects.
the class QuerydslRepositorySupportTests method shouldAllowAny.
// DATAMONGO-1063
@Test
public void shouldAllowAny() {
person.setSkills(Arrays.asList("vocalist", "songwriter", "guitarist"));
operations.save(person);
QPerson p = QPerson.person;
SpringDataMongodbQuery<Person> query = repoSupport.from(p).where(p.skills.any().in("guitarist"));
assertThat(query.fetchOne(), is(person));
}
use of org.springframework.data.mongodb.repository.Person in project spring-data-mongodb by spring-projects.
the class QuerydslRepositorySupportTests method setUp.
@Before
public void setUp() {
operations.remove(new Query(), Person.class);
person = new Person("Dave", "Matthews");
operations.save(person);
repoSupport = new QuerydslRepositorySupport(operations) {
};
}
use of org.springframework.data.mongodb.repository.Person in project spring-data-mongodb by spring-projects.
the class SimpleMongoRepositoryTests method countByExampleShouldLookUpEntriesCorrectly.
// DATAMONGO-1245
@Test
public void countByExampleShouldLookUpEntriesCorrectly() {
Person sample = new Person();
sample.setLastname("Matthews");
trimDomainType(sample, "id", "createdAt", "email");
assertThat(repository.count(Example.of(sample))).isEqualTo(2L);
}
use of org.springframework.data.mongodb.repository.Person in project spring-data-mongodb by spring-projects.
the class SimpleMongoRepositoryTests method findAllByExampleShouldLookUpEntriesCorrectly.
// DATAMONGO-1245
@Test
public void findAllByExampleShouldLookUpEntriesCorrectly() {
Person sample = new Person();
sample.setLastname("Matthews");
trimDomainType(sample, "id", "createdAt", "email");
assertThat(repository.findAll(Example.of(sample))).hasSize(2).contains(dave, oliver);
}
Aggregations