1、查询mongodb单个字段的所有值内容:db.getCollection('amac').find({},{"managerName":1,"_id":0}) //PS:"_id":0表示不显示id值
java:
//mongoDB数据读取,存入MYSQL数据库 private static void readMongo(){ Connection conn = MysqlUtil.getConnection();//连接mysql Statement statement = null; MongoClient mongoClient=new MongoClient("119.xx.xx.xxx",27017);//连接mongoDB数据库 DB database=mongoClient.getDB("row");//获取数据库 DBCollection coll