摘要:Java & MongoDB
MongoDB下載位置:
http://www.mongodb.org/downloads
下載後,將解壓縮資料放置 C://mongodb/下
建立C://data/db ,他預設會將資料擺至這個地方,必須先建立
執行C://mongodb/bin/mongod.exe
下載Java MongoDB的jar檔
https://github.com/mongodb/mongo-java-driver/downloads
MongoDB管理工具 - MongoVUE
http://blog.mongovue.com/downloads/
create Connection
Mongo mongo = new Mongo();
DB db = mongo.getDB(database_name);
insert collection
BasicDBObject doc = new BasicDBObject();
doc.put("name","TomLai");
doc.put("age","28");
DBCollection collection = db.getCollection(collection_name);
collection.save(doc);