Example usage for com.mongodb MongoClientOptions.Builder dbDecoderFactory

List of usage examples for com.mongodb MongoClientOptions.Builder dbDecoderFactory

Introduction

In this page you can find the example usage for com.mongodb MongoClientOptions.Builder dbDecoderFactory.

Prototype

DBDecoderFactory dbDecoderFactory

To view the source code for com.mongodb MongoClientOptions.Builder dbDecoderFactory.

Click Source Link

Usage

From source file:org.fastmongo.odm.client.MongoClientFactory.java

License:Apache License

public MongoClient createMongoClient() {
    MongoClientOptions.Builder options = MongoClientOptions.builder();
    if (useBsonDecoder) {
        options.dbDecoderFactory(BsonDbDecoderFactory.INSTANCE);
    }/* w  w w.ja v a2  s  .  co  m*/

    MongoClientURI clientUri = new MongoClientURI(this.uri, options);

    try {
        return new MongoClient(clientUri);
    } catch (UnknownHostException e) {
        throw new RuntimeException("Can't create MongoClient with uri = " + clientUri, e);
    }
}