-1
嘿傢伙怎麼這樣MongoDB的語法編寫到Java寫的MongoDB語法
db.users.find({ user_id: /bc/ },{user_name:/bc/},{age:/2/})
我的源是
BasicDBObject sortOrder = new BasicDBObject();
MongoClient mongoClient;
DB db;
DBCollection table;
DBCursor cursor = null;
mongoClient = new MongoClient("localhost", 27017);
db = mongoClient.getDB("stackoverflow");
boolean auth = db.authenticate("aku","kamu".toCharArray());
table = db.getCollection("questions");
cursor = table.find();
while (cursor.hasNext()) {
DBObject object = cursor.next();
out.print(object.get("title"));
answer = rn.nextInt(8) + 0;
}
任何解決方案的傢伙? 我是新手使用MongoDB的
對不起之前,我的意思是如何添加或正則表達式 條款我已經添加 光標= table.find(新BasicDBObject(「稱號」,java.util.regex.Pattern.compile(「牛奶」))) ; 它的成功,但如何,如果我想添加更多的正則表達式像問題..感謝之前:) – beboy
分享你已經嘗試過 – MoienGK