我只想检索值小于4的ID列,
MongoDatabase database = client.getDatabase("d");
MongoCollection<org.bson.Document> contCol = database.getCollection("test");
BasicDBObject query = new BasicDBObject();
query.put("ID",1);
FindIterable<org.bson.Document> it = contCol.find().projection(excludeId());
不给我所需的输出。集合 test 有两列,即 ID 和 name ;查询返回两列,我只想获取 ID 列。