List of usage examples for com.mongodb Bytes QUERYOPTION_NOTIMEOUT
int QUERYOPTION_NOTIMEOUT
To view the source code for com.mongodb Bytes QUERYOPTION_NOTIMEOUT.
Click Source Link
From source file:statistics.Statistics.java
License:Open Source License
public static void main(String[] args) { DBHelper db = DBHelper.getInstance(); DBCursor cursor = db.findMatrixRows().addOption(Bytes.QUERYOPTION_NOTIMEOUT); int counts[] = new int[12 * 2]; float totalEntries = 0.0f; while (cursor.hasNext()) { DBObject item = cursor.next();/*from w ww . j a v a 2 s.c o m*/ int count = 0; Boolean hasAtLeastOneEvent = false; for (Event.TYPE everyType : Event.TYPE.values()) { if ((Boolean) item.get("has_twitter_" + everyType.name().toLowerCase()) == true) { hasAtLeastOneEvent = true; ++counts[count]; } if ((Boolean) item.get("has_facebook_" + everyType.name().toLowerCase()) == true) { hasAtLeastOneEvent = true; ++counts[count + 1]; } count += 2; } if (hasAtLeastOneEvent) { ++totalEntries; } } int count = 0; for (Event.TYPE everyType : Event.TYPE.values()) { System.out.println(everyType.name() + " : T " + counts[count] + " / " + counts[count] / totalEntries + " per album / F " + counts[count + 1] + " / " + counts[count + 1] / totalEntries + " per album"); count += 2; } System.out.println("Total number of albums with events : " + totalEntries); }