This is specifically for Mongo 3.x, where MongoCollection is preferred over DBCollection. Adding for personal archiving.
MongoCollection
getMongoCollection(databaseName, collectionName);
FindIterable
mongoCollection.find(eq(COLUMN, "lastName"))
.sort(ascending("lastname"));
for (Document document : documents) {
...
}
Leave a Reply