List of usage examples for com.mongodb BasicDBObjectBuilder start
public static BasicDBObjectBuilder start()
From source file:org.geogit.storage.mongo.MongoGraph.java
License:Open Source License
public Iterable<Edge> getEdges(String key, Object value) { DBObject query = BasicDBObjectBuilder.start().push("_in").append("$exists", 1).pop().push("_out") .append("$exists", 1).pop().append("_properties." + key, value).get(); return getEdges(query); }
From source file:org.geogit.storage.mongo.MongoGraph.java
License:Open Source License
public Iterable<Vertex> getVertices() { DBObject query = BasicDBObjectBuilder.start().push("_in").append("$exists", 0).pop().push("_out") .append("$exists", 0).pop().get(); return getVertices(query); }
From source file:org.geogit.storage.mongo.MongoGraph.java
License:Open Source License
public Iterable<Vertex> getVertices(String key, Object value) { DBObject query = BasicDBObjectBuilder.start().push("_in").append("$exists", 0).pop().push("_out") .append("$exists", 0).pop().append("_properties." + key, value).get(); return getVertices(query); }
From source file:org.geogit.storage.mongo.MongoObjectDatabase.java
License:Open Source License
private long deleteChunk(List<ObjectId> ids) { List<String> idStrings = Lists.transform(ids, Functions.toStringFunction()); DBObject query = BasicDBObjectBuilder.start().push("oid").add("$in", idStrings).pop().get(); WriteResult result = collection.remove(query); return result.getN(); }
From source file:org.geotools.data.mongodb.FilterToMongo.java
License:LGPL
@Override public Object visit(BBOX filter, Object extraData) { BasicDBObject output = asDBObject(extraData); //TODO: handle swapping of operands Object e1 = filter.getExpression1().accept(this, Geometry.class); Envelope envelope = filter.getExpression2().evaluate(null, Envelope.class); DBObject dbo = BasicDBObjectBuilder.start().push("$geoIntersects") .add("$geometry", geometryBuilder.toObject(envelope)).get(); output.put((String) e1, dbo); return output; }
From source file:org.geotools.data.mongodb.FilterToMongo.java
License:LGPL
@Override public Object visit(Intersects filter, Object extraData) { BasicDBObject output = asDBObject(extraData); //TODO: handle swapping of operands Object e1 = filter.getExpression1().accept(this, Geometry.class); Geometry geometry = filter.getExpression2().evaluate(null, Geometry.class); DBObject dbo = BasicDBObjectBuilder.start().push("$geoIntersects") .add("$geometry", geometryBuilder.toObject(geometry)).get(); output.put((String) e1, dbo); return output; }
From source file:org.geotools.data.mongodb.FilterToMongo.java
License:LGPL
@Override public Object visit(Within filter, Object extraData) { BasicDBObject output = asDBObject(extraData); //TODO: handle swapping of operands Object e1 = filter.getExpression1().accept(this, Geometry.class); Geometry geometry = filter.getExpression2().evaluate(null, Geometry.class); DBObject dbo = BasicDBObjectBuilder.start().push("$geoWithin") .add("$geometry", geometryBuilder.toObject(geometry)).get(); output.put((String) e1, dbo); return output; }
From source file:org.graylog2.indexer.IndexFailureServiceImpl.java
License:Open Source License
@Inject public IndexFailureServiceImpl(MongoConnection mongoConnection) { super(mongoConnection); // Make sure that the index failures collection is always created capped. final String collectionName = IndexFailureImpl.class.getAnnotation(CollectionName.class).value(); if (!mongoConnection.getDatabase().collectionExists(collectionName)) { DBObject options = BasicDBObjectBuilder.start().add("capped", true).add("size", 52428800) // 50MB max size. .get();/*ww w .j av a 2s .c om*/ mongoConnection.getDatabase().createCollection(collectionName, options); } }
From source file:org.jeo.mongo.DefaultMapper.java
License:Open Source License
@Override public DBObject query(Envelope bbox, MongoDataset data) { Polygon p = Envelopes.toPolygon(bbox); return BasicDBObjectBuilder.start().push(mapping.geometry().join()).push("$geoIntersects") .append("$geometry", GeoJSON.toObject(p)).get(); }
From source file:org.jeo.mongo.GeoJSONTestData.java
License:Open Source License
public void setUp(DBCollection dbcol, MongoWorkspace workspace) throws IOException { VectorDataset data = TestData.states(); for (Feature f : data.cursor(new Query())) { f.put("geometry", Geom.iterate((MultiPolygon) f.geometry()).iterator().next()); dbcol.insert((DBObject) JSON.parse(GeoJSONWriter.toString(f))); }/* w ww. ja v a 2 s . c o m*/ dbcol.ensureIndex(BasicDBObjectBuilder.start().add("geometry", "2dsphere").get()); workspace.setMapper(new GeoJSONMapper()); }