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

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


    assertEquals("{ \"unique\" : true , \"sparse\" : true}", i.getIndexOptions().toString());
  }

  @Test
  public void testGeospatialIndex() {
    GeospatialIndex i = new GeospatialIndex("location").withMin(0);
    assertEquals("{ \"location\" : \"2d\"}", i.getIndexKeys().toString());
    assertEquals("{ \"min\" : 0}", i.getIndexOptions().toString());
  }
View Full Code Here


   * @see DATAMONGO-778
   */
  @Test
  public void testGeospatialIndex2DSphere() {

    GeospatialIndex i = new GeospatialIndex("location").typed(GeoSpatialIndexType.GEO_2DSPHERE);
    assertEquals("{ \"location\" : \"2dsphere\"}", i.getIndexKeys().toString());
    assertEquals("{ }", i.getIndexOptions().toString());
  }
View Full Code Here

   * @see DATAMONGO-778
   */
  @Test
  public void testGeospatialIndexGeoHaystack() {

    GeospatialIndex i = new GeospatialIndex("location").typed(GeoSpatialIndexType.GEO_HAYSTACK)
        .withAdditionalField("name").withBucketSize(40);
    assertEquals("{ \"location\" : \"geoHaystack\" , \"name\" : 1}", i.getIndexKeys().toString());
    assertEquals("{ \"bucketSize\" : 40.0}", i.getIndexOptions().toString());
  }
View Full Code Here

  @Before
  public void setUp() throws Exception {

    template.setWriteConcern(WriteConcern.FSYNC_SAFE);
    template.indexOps(Venue.class).ensureIndex(new GeospatialIndex("location"));

    indexCreated();
    addVenues();
  }
View Full Code Here

  @Autowired
  MongoTemplate template;

  @Before public void setUp() {
     // ensure geospatial index
     template.indexOps(Location.class).ensureIndex( new GeospatialIndex("position") );
     // prepare data
     repo.save( new Location("A", 0.001, -0.002) );
     repo.save( new Location("B", 1, 1) );
     repo.save( new Location("C", 0.5, 0.5) );
     repo.save( new Location("D", -0.5, -0.5) );
View Full Code Here

  @Before
  public void setUp() {
    final List<Location> locations = new ArrayList<Location>();
   
     // ensure geospatial index
     template.indexOps(Location.class).ensureIndex( new GeospatialIndex("position") );
    
     // prepare data
     for ( int i = 0;  i < N_POINTS; i++ ) {
       locations.add( new Location(String.valueOf(i), rnd(), rnd()) );
     }
View Full Code Here

TOP

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

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.