Posts

Showing posts with the label mongodb-java

MongoDB Java API slow reading peformance

We are reading from a local MongoDB all documents from a collections and performance is not very brillant. We need to dump all the data, don't be concerned why, just trust it's really needed and there is no workaround possible. We've 4mio documents that look like : { "_id":"4d094f58c96767d7a0099d49", "exchange":"NASDAQ", "stock_symbol":"AACC", "date":"2008-03-07", "open":8.4, "high":8.75, "low":8.08, "close":8.55, "volume":275800, "adj close":8.55 } And we're using this for now trivial code to read: MongoClient mongoClient = MongoClients.create(); MongoDatabase database = mongoClient.getDatabase("localhost"); MongoCollection<Document> collection = database.getCollection("test"); MutableInt count = new MutableInt(); long start = System.currentTimeMillis(); collection.f...