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

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

Introduction

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

Prototype

public static IndexField create(String key, Direction order) 

Source Link

Usage

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

/**
 * @see DATAMONGO-360//from w  w  w  .java  2  s.co  m
 */
@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")));
}