Example usage for com.mongodb.async.client MongoCollection find

List of usage examples for com.mongodb.async.client MongoCollection find

Introduction

In this page you can find the example usage for com.mongodb.async.client MongoCollection find.

Prototype

FindIterable<TDocument> find(ClientSession clientSession);

Source Link

Document

Finds all documents in the collection.

Usage

From source file:mongodb.clients.percunia.mongo.AsyncClient.java

License:Apache License

@Override
public void getDocumentFieldValueViaFilter(final String collectionName, Criteria criteria,
        final ResultCallback callback) {

    MongoCollection<Document> collection = database.getCollection(collectionName);

    collection.find(criteria.getRestrictions()).projection(criteria.getProjections())
            .first(new SingleResultCallback<Document>() {
                @Override//w  w  w.j  a  v  a2 s .  c o m
                public void onResult(final Document document, final Throwable t) {
                    onDocumentResult(document, t, "success", callback);
                }
            });

}

From source file:mongodb.clients.percunia.mongo.AsyncClient.java

License:Apache License

@Override
public void getDocumentViaFilter(final String collectionName, Criteria criteria,
        final ResultCallback callback) {

    MongoCollection<Document> collection = database.getCollection(collectionName);
    collection.find(criteria.getRestrictions()).first(new SingleResultCallback<Document>() {
        @Override//from   w  w w .  j  av a 2 s  .co  m
        public void onResult(final Document document, final Throwable t) {
            onDocumentResult(document, t, "success", callback);
        }
    });
}