标签:sys rate highlight div 合数 client cli creat void
public class mongo { public static void main(String[] args) { // TODO Auto-generated method stub MongoClient mo = new MongoClient("127.0.0.1",27017); DB db = mo.getDB("wtdd"); DBCollection col = db.getCollection("wtdd"); DBObject o = new BasicDBObject("name","jim"); DBCursor cur = col.find(); for(DBObject obc:cur) { System.out.println(obc); } } //db.createCollection("wt", new DBObject()); }
连接数据库输出集合数据
查找固定的数据
public class mongo { public static void main(String[] args) { // TODO Auto-generated method stub MongoClient mo = new MongoClient("127.0.0.1",27017); DB db = mo.getDB("wtdd"); DBCollection col = db.getCollection("wtd"); DBObject o = new BasicDBObject("name","jim"); DBCursor lis = col.find(o); for(DBObject obj:lis) { System.out.println(obj); } }
}
标签:sys rate highlight div 合数 client cli creat void
原文地址:https://www.cnblogs.com/0123wtdd/p/10717482.html