Package com.mysema.query.mongodb.domain

Examples of com.mysema.query.mongodb.domain.GeoEntity


        ds.getCollection(GeoEntity.class).ensureIndex(new BasicDBObject("location","2d"));;
    }

    @Test
    public void Near() {
        ds.save(new GeoEntity(10.0, 50.0));
        ds.save(new GeoEntity(20.0, 50.0));
        ds.save(new GeoEntity(30.0, 50.0));

        List<GeoEntity> entities = query().where(geoEntity.location.near(50.0, 50.0)).list();
        assertEquals(30.0, entities.get(0).getLocation()[0].doubleValue(), 0.1);
        assertEquals(20.0, entities.get(1).getLocation()[0].doubleValue(), 0.1);
        assertEquals(10.0, entities.get(2).getLocation()[0].doubleValue(), 0.1);
View Full Code Here

TOP

Related Classes of com.mysema.query.mongodb.domain.GeoEntity

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.