Mongo学习笔记(四)

mongo-java连接

mongo java驱动https://github.com/mongodb/mongo-java-driver/downloads

mongo数据库的端口是27071。默认连接本地


Mongo m = new Mongo();

DB db = m.getDB("test");

DBCollection testOne = db.getCollection("testOne");

DBCursor dc = testOne.find();

while(dc.hasNext()){

System.out.println(dc.next());

}


你可能感兴趣的:(数据库,mongo,NoSQL)