0

I am now using perl script client to store some big data into mongoDB .But now I met a problem ,some document exceeds the size limit of 16M,so ,I have to choose GridFS.From the GridFS document ,I read this:

GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.

Instead of storing a file in a single document, GridFS divides a file into parts, or chunks, [1] and stores each of those chunks as a separate document. By default GridFS limits chunk size to 256k.

It really make me confused.What does it mean by "file"?"Instead of storing a file in a single document",it means , mongoDB stores a file in a single document without using GridFS,right ?But I think it should say:"Instead of storing a document in a single file,...".So ,the relationship and difference between "file" and "document" make me confused.

Sammaye
  • 43,242
  • 7
  • 104
  • 146
wuchang
  • 3,003
  • 8
  • 42
  • 66
  • possible duplicate of [How should I use MongoDB GridFS to store my big-size data?](http://stackoverflow.com/questions/18736582/how-should-i-use-mongodb-gridfs-to-store-my-big-size-data) – WiredPrairie Sep 11 '13 at 10:51

1 Answers1

1

What does it mean by "file"?

A file. A word document, Excel spreadsheet, HTML file anything that is a file. GridFS is designed for file storage.

it means , mongoDB stores a file in a single document

MongoDB does not do anything, it does not even manage GridFS, the documentation assumes you come to GridFS after encountering the limited size of a single document, as you have.

Instead of storing a document in a single file,...

Nope, that is incorrect. What is a document? MongoDBs own records are called documents, how can you store those within files in the database? You store data within documents in the database.

So ,the relationship and difference between "file" and "document" make me confused.

File is a physical file and a document is basically a row.

Sammaye
  • 43,242
  • 7
  • 104
  • 146
  • But the reason I have to use GridFS is that my single document(not a "file", like a video or a music) exceeds the limit.So ,I don't know what is my next step – wuchang Sep 11 '13 at 08:09
  • In my opinion , I don't need to know how MongoDB store my document ,my collection or my database into one or several files.But now ,using GridFS, "files" seems come from the background to the foreground.It is what make me confused. – wuchang Sep 11 '13 at 08:12
  • High , I really need your help.What I mean ,is that it is not a simple physical file like "hello.rmvb" or "love.mp3" which exceeds the limit ,it is several very large gene sequence string(is not stored as a file ,but read in memory) which exceeds the limit.So ,what can I do to solve this problem? – wuchang Sep 11 '13 at 09:07
  • @Vico_Wu Hmm if it is genetic research you are doing then I remember another thread about this on the google group – Sammaye Sep 11 '13 at 09:08
  • No ,it is just a project.I learned mongoDB for just one week. – wuchang Sep 11 '13 at 09:12
  • @Vico_Wu You may have chosen a very hard project here – Sammaye Sep 11 '13 at 09:15