Package org.springframework.data.mongodb.core.index

Examples of org.springframework.data.mongodb.core.index.IndexInfo


          boolean unique = ix.containsField("unique") ? (Boolean) ix.get("unique") : false;
          boolean dropDuplicates = ix.containsField("dropDups") ? (Boolean) ix.get("dropDups") : false;
          boolean sparse = ix.containsField("sparse") ? (Boolean) ix.get("sparse") : false;
          String language = ix.containsField("default_language") ? (String) ix.get("default_language") : "";
          indexInfoList.add(new IndexInfo(indexFields, name, unique, dropDuplicates, sparse, language));
        }

        return indexInfoList;
      }
    });
View Full Code Here


    assertThat(dropDupes, is(true));

    List<IndexInfo> indexInfoList = template.indexOps(Person.class).getIndexInfo();

    assertThat(indexInfoList.size(), is(2));
    IndexInfo ii = indexInfoList.get(1);
    assertThat(ii.isUnique(), is(true));
    assertThat(ii.isDropDuplicates(), is(true));
    assertThat(ii.isSparse(), is(false));

    List<IndexField> indexFields = ii.getIndexFields();
    IndexField field = indexFields.get(0);

    assertThat(field, is(IndexField.create("age", Direction.DESC)));
  }
View Full Code Here

    }

    assertThat(indexKey, is("{ \"age\" : -1.0}"));
    assertThat(unique, is(true));

    IndexInfo info = template.indexOps(Person.class).getIndexInfo().get(1);
    assertThat(info.isUnique(), is(true));
    assertThat(info.isSparse(), is(true));

    List<IndexField> indexFields = info.getIndexFields();
    IndexField field = indexFields.get(0);

    assertThat(field, is(IndexField.create("age", Direction.DESC)));
  }
View Full Code Here

  @Test
  public void getIndexInfoShouldBeAbleToRead2dsphereIndex() {

    collection.createIndex(GEO_SPHERE_2D);

    IndexInfo info = findAndReturnIndexInfo(GEO_SPHERE_2D);
    assertThat(info.getIndexFields().get(0).isGeo(), is(true));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.index.IndexInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.