Example usage for org.springframework.data.mongodb.core.index IndexField geo

List of usage examples for org.springframework.data.mongodb.core.index IndexField geo

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.index IndexField geo.

Prototype

public static IndexField geo(String key) 

Source Link

Document

Creates a geo IndexField for the given key.

Usage

From source file:org.springframework.data.mongodb.core.geo.GeoSpatialTests.java

/**
 * @see DATAMONGO-360/*from   www.ja v a  2  s .com*/
 */
@Test
public void indexInfoIsCorrect() {

    IndexOperations operations = template.indexOps(Venue.class);
    List<IndexInfo> indexInfo = operations.getIndexInfo();

    assertThat(indexInfo.size(), is(2));

    List<IndexField> fields = indexInfo.get(0).getIndexFields();
    assertThat(fields.size(), is(1));
    assertThat(fields, hasItem(IndexField.create("_id", Direction.ASC)));

    fields = indexInfo.get(1).getIndexFields();
    assertThat(fields.size(), is(1));
    assertThat(fields, hasItem(IndexField.geo("location")));
}