我正在开发一个访问MongoDB
分片群集的Java驱动程序。当我尝试在数据库find()
的集合"test"
上执行"db"
方法时,它不返回任何内容。但是,我已通过mongo客户端检查了该特定集合中的某些文档。有人可以帮忙吗?非常感谢。
public class App {
public static void main(String[] args) {
/**** Connect to MongoDB ****/
MongoClient mongo = new MongoClient(Arrays.asList(new ServerAddress(
"10.110.198.147", 27017), new ServerAddress("10.110.198.160",
27017)));
/**** Get database ****/
// if database doesn't exists, MongoDB will create it for you
DB db = mongo.getDB("db");
/**** Get collection / table from 'testdb' ****/
// if collection doesn't exists, MongoDB will create it for you
DBCollection coll = db.getCollection("test");
BasicDBObject document = new BasicDBObject();
document.put("count", "1000");
coll.insert(document);
DBCursor cursor = coll.find();
while (cursor.hasNext()) {
System.out.println(cursor.next());
}
}
}
答案 0 :(得分:0)
你能试试吗?
var blob = new Blob($scope.myArray , {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, "Report.xls");
};
在文档here
上找到它