driver-legacy/src/main/com/mongodb/DBCursor.java
public List<DBObject> toArray(final int max) {
        checkIteratorOrArray(IteratorOrArray.ARRAY);
        fillArray(max - 1);
        return all;
    }
public List<DBObject> toArray(final int max) {
        checkIteratorOrArray(IteratorOrArray.ARRAY);
        fillArray(max - 1);
        return all;
    }
Converts this cursor to an array.

@param max the maximum number of objects to return
@return an array of objects
@throws MongoException if failed