/** * <p>Return a list of cursors over the collection that can be used to scan it in parallel.</p> * * <p>Note: As of MongoDB 2.6, this method will work against a mongod, but not a mongos. </p> * * @param options the parallel scan options * @return a list of cursors, whose size may be less than the number requested * @mongodb.driver.manual reference/command/parallelCollectionScan/ Parallel Collection Scan * @mongodb.server.release 2.6 * @since 2.12 * @deprecated the parallelCollectionScan command will be removed in MongoDB 4.2 */ @Deprecated public List<Cursor> parallelScan(final ParallelScanOptions options) { List<Cursor> cursors = new ArrayList<Cursor>(); ParallelCollectionScanOperation<DBObject> operation = new ParallelCollectionScanOperation<DBObject>(getNamespace(), options.getNumCursors(), objectCodec) .batchSize(options.getBatchSize()); ReadPreference readPreferenceFromOptions = options.getReadPreference(); List<BatchCursor<DBObject>> mongoCursors = executor.execute(operation, readPreferenceFromOptions != null ? readPreferenceFromOptions : getReadPreference(), getReadConcern()); for (BatchCursor<DBObject> mongoCursor : mongoCursors) { cursors.add(new MongoCursorAdapter(new MongoBatchCursorAdapter<DBObject>(mongoCursor))); } return cursors; }
/** * <p>Return a list of cursors over the collection that can be used to scan it in parallel.</p> * * <p>Note: As of MongoDB 2.6, this method will work against a mongod, but not a mongos. </p> * * @param options the parallel scan options * @return a list of cursors, whose size may be less than the number requested * @mongodb.driver.manual reference/command/parallelCollectionScan/ Parallel Collection Scan * @mongodb.server.release 2.6 * @since 2.12 * @deprecated the parallelCollectionScan command will be removed in MongoDB 4.2 */ @Deprecated public List<Cursor> parallelScan(final ParallelScanOptions options) { List<Cursor> cursors = new ArrayList<Cursor>(); ParallelCollectionScanOperation<DBObject> operation = new ParallelCollectionScanOperation<DBObject>(getNamespace(), options.getNumCursors(), objectCodec) .batchSize(options.getBatchSize()); ReadPreference readPreferenceFromOptions = options.getReadPreference(); List<BatchCursor<DBObject>> mongoCursors = executor.execute(operation, readPreferenceFromOptions != null ? readPreferenceFromOptions : getReadPreference(), getReadConcern()); for (BatchCursor<DBObject> mongoCursor : mongoCursors) { cursors.add(new MongoCursorAdapter(new MongoBatchCursorAdapter<DBObject>(mongoCursor))); } return cursors; }