Example usage for org.springframework.data.mongodb.core.mapping GeoLocation GeoLocation

List of usage examples for org.springframework.data.mongodb.core.mapping GeoLocation GeoLocation

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.mapping GeoLocation GeoLocation.

Prototype

public GeoLocation(double[] location) 

Source Link

Usage

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);//w  w w  . ja v a  2s. 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));
}