227.5. GridFS 작업 - 생산자 끝점

227.5.1. count

컬렉션의 총 파일 수를 반환 하 고 OUT 메시지 본문으로 Integer를 반환 합니다.Returns the total number of file in the collection, returning an Integer as the OUT message body.

// from("direct:count").to("mongodb-gridfs?database=tickets&operation=count");
Integer result = template.requestBodyAndHeader("direct:count", "irrelevantBody");
assertTrue("Result is not of type Long", result instanceof Integer);

파일 이름 헤더를 지정하여 해당 파일 이름과 일치하는 파일 수를 제공할 수 있습니다.

Map<String, Object> headers = new HashMap<String, Object>();
headers.put(Exchange.FILE_NAME, "filename.txt");
Integer count = template.requestBodyAndHeaders("direct:count", query, headers);