No SQL > Mongo DB > How to remove a Document from Mongo Database
How to remove a Document from Mongo Database
MongoDB is a scalable, high-performance, open source NoSQL database.
It offers Ad hoc queries, Indexing, Replication, Load balancing, File storage (GridFS), Aggregation,
MapReduce and Server-side JavaScript execution.
This requires the library mongo-2.8.0.jar to be present in the classpath.
The following example shows how to remove a document from Mongo database.
private static void listAll(DBCollection collection) {
//Queries for all objects in this collection
DBCursor dbCursor = collection.find();
DBObject record = null;
while (dbCursor.hasNext()) {
record = dbCursor.next();
System.out.println(record);
}
}
}