/** * Creates a GridFS instance for the specified bucket * in the given database. * * @param db database to work with * @param bucket bucket to use in the given database */ public GridFS(DB db, string bucket) { _db = db; _bucketName = bucket; _filesCollection = _db.getCollection(_bucketName + ".files"); _chunkCollection = _db.getCollection(_bucketName + ".chunks"); _chunkCollection.ensureIndex(BasicDBObjectBuilder.start().Add("files_id", 1).Add("n", 1).get()); _filesCollection.setObjectClass(typeof(GridFSDBFile)); }