Examples of MongoCredential


Examples of com.mongodb.MongoCredential

        {
            mongo = new MongoClient( serverAddresses );
        }
        else
        {
            MongoCredential credential = MongoCredential.createMongoCRCredential( username, databaseName, password );
            mongo = new MongoClient( serverAddresses, Arrays.asList( credential ) );
        }
        db = mongo.getDB( databaseName );

        // Create index if needed
View Full Code Here

Examples of com.mongodb.MongoCredential

                        String user = config.get("user");
                        String password = config.get("password");

                        MongoClientOptions clientOptions = getClientOptions();
                        if (user != null && password != null) {
                            MongoCredential credential = MongoCredential.createMongoCRCredential(user, dbName, password.toCharArray());
                            client = new MongoClient(new ServerAddress(host, port), Collections.singletonList(credential), clientOptions);
                        } else {
                            client = new MongoClient(new ServerAddress(host, port), clientOptions);
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.