1. java连接mongodb
MongoClient mongoClient;
MongoCredential credential = MongoCredential.createCredential("user", "database", password);
mongoClient = new MongoClient(new ServerAddress(ip, port), Arrays.asList(credential));
2. python连接mongodb
from pymongo import MongoClient
client = MongoClient("ip",port)
client.database.authenticate("user","password")
db = client.database
collection = db.collection