Example usage for org.springframework.data.mongodb.core SimpleMongoDbFactory SimpleMongoDbFactory

List of usage examples for org.springframework.data.mongodb.core SimpleMongoDbFactory SimpleMongoDbFactory

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core SimpleMongoDbFactory SimpleMongoDbFactory.

Prototype

public SimpleMongoDbFactory(MongoClientURI uri) 

Source Link

Document

Creates a new SimpleMongoDbFactory instance from the given MongoClientURI .

Usage

From source file:com.mycompany.config.MongoConfig.java

@Bean
public MongoDbFactory mongoDbFactory() throws Exception {
    // return new SimpleMongoDbFactory(new MongoClient("localhost", 27017), "local");
    // UserCredentials userCredentials = new UserCredentials("gurkan", "gurkan91");
    String textUri = "mongodb://gurkan:gurkan91@ds041484.mongolab.com:41484/markerdata";
    MongoClientURI uri = new MongoClientURI(textUri);
    //return new SimpleMongoDbFactory(new MongoClient(uri));
    return new SimpleMongoDbFactory(uri);
}

From source file:com.jelastic.campitos.SpringMongoConfig.java

public @Bean SimpleMongoDbFactory mongoDbFactory() throws Exception {
    //MongoURI uri=new MongoURI("mongodb://campitos:celiesita1951@paulo.mongohq.com:10017/htxiBv8O8SYnF8rGqmUQhw");
    MongoURI uri = new MongoURI("mongodb://campitos:celiesita@paulo.mongohq.com:10037/campitos-base");

    return new SimpleMongoDbFactory(uri);

}