java
MongoClient mongoClient;
MongoCredential credential = MongoCredential.createCredential(“user”, “database”, “password”);
mongoClient = new MongoClient(new ServerAddress(ip, port), Arrays.asList(credential));python
from pymongo import MongoClient
client = MongoClient(“ip”,port)
client.database.authenticate(“user”,”password”)
db = client.database
collection = db.collectionnodejs
var mongoose = require(“mongoose”);
mongoose.connect(“mongodb://username:password@localhost:27017/test”);
各语言连接mongodb
最新推荐文章于 2023-12-07 14:24:30 发布