public List < GridFSDBFile > find ( final DBObject query , final DBObject sort ) { List < GridFSDBFile > files = new ArrayList < GridFSDBFile > ( ) ; DBCursor cursor = filesCollection . find ( query ) ; if ( sort != null ) { cursor . sort ( sort ) ; } try { while ( cursor . hasNext ( ) ) { files . add ( injectGridFSInstance ( cursor . next ( ) ) ) ; } } finally { cursor . close ( ) ; } return Collections . unmodifiableList ( files ) ; }
Finds a list of files matching the given query .