mongodb find fields in java

mongodb find fields in java

BasicDBObject query = new BasicDBObject(); //建立一個無條件查詢
BasicDBObject fields = new BasicDBObject("Name",1);  //代表有這筆資料
coll.find(query, fields); //這邊就會回傳只有Name欄位的結果