List of usage examples for org.springframework.data.mongodb.core.mapping PersonWithDbRef PersonWithDbRef
public PersonWithDbRef(Integer ssn, String firstName, String lastName, GeoLocation home)
From source file:org.springframework.data.mongodb.core.mapping.MappingTests.java
@Test public void testDbRef() { double[] pos = new double[] { 37.0625, -95.677068 }; GeoLocation geo = new GeoLocation(pos); template.insert(geo);//from w ww . j a v a 2 s . co m PersonWithDbRef p = new PersonWithDbRef(4321, "With", "DBRef", geo); template.insert(p); List<PersonWithDbRef> result = template.find(new Query(Criteria.where("ssn").is(4321)), PersonWithDbRef.class); assertThat(result.size(), is(1)); assertThat(result.get(0).getHome().getLocation(), is(pos)); }