Received: by 10.42.172.68 with SMTP id m4mr8125608icz.1.1349581279425; Sat, 06 Oct 2012 20:41:19 -0700 (PDT) X-BeenThere: mongodb-user@googlegroups.com Received: by 10.42.249.136 with SMTP id mk8ls10935041icb.9.gmail; Sat, 06 Oct 2012 20:41:08 -0700 (PDT) Received: by 10.42.120.134 with SMTP id f6mr332841icr.4.1349581268830; Sat, 06 Oct 2012 20:41:08 -0700 (PDT) Received: by 10.50.0.146 with SMTP id 18msige; Sat, 6 Oct 2012 19:17:13 -0700 (PDT) Received: by 10.68.219.198 with SMTP id pq6mr4013525pbc.0.1349576233269; Sat, 06 Oct 2012 19:17:13 -0700 (PDT) Date: Sat, 6 Oct 2012 19:17:12 -0700 (PDT) From: Rahul Jaiswal To: mongodb-user@googlegroups.com Message-Id: <8e62ebdd-b331-412e-a83a-d5de0f5c6933@googlegroups.com> Subject: Spring GridFsOperations (Java) API for storing in mongo with a custom prefix MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1091_11574263.1349576232940" ------=_Part_1091_11574263.1349576232940 Content-Type: multipart/alternative; boundary="----=_Part_1092_13606269.1349576232940" ------=_Part_1092_13606269.1349576232940 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit I am using GridFsOperations API of spring-data for mongodb to store large files in chunks in the db. Here is my code: @Autowired private GridFsOperations gridOperation; public String save(InputStream inputStream, String contentType, String filename) { ... GridFSFile file = gridOperation.store(inputStream, filename, metaData); return file.getId().toString(); } The code works fine but it always stores files in collections starting with prefix "fs", which is the default in mongodb. Is there a way to specify a different prefix so that I can have different files and chunks for different kinds of files to be stored? EDIT: additional question How do I specify the chunk size? Is it advisable to have different chunk sizes for different kinds of files, for example, 1 mb for image files and 10 mb for video files? Thanks in advance ------=_Part_1092_13606269.1349576232940 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

I am using GridFsOperations API of spring-data for mongodb to store lar= ge files in chunks in the db. Here is my code:

@Autowired
private GridFsOperations gridOperation;

public String save(InputStream inputStream, String contentType, String file=
name) {
  ...
  GridFSFile file =3D gridOperation.store(inputStream, filename, metaData);
  return file.getId().toString();
}

EDIT: additional que= stion

How do I specify the chunk size? Is it advisable to have diffe= rent chunk sizes for different kinds of files, for example, 1 mb for image = files and 10 mb for video files?

Thanks in advance

------=_Part_1092_13606269.1349576232940-- ------=_Part_1091_11574263.1349576232940--