I think you are getting confused over the word "document".
A MongoDB "document" is analogous to a "record" in a relational database table. It is formatted like JSON although the actual storage format is BSON as described here: JSON and BSON
A MongoDB "collection" is analogous to a relational database table i.e. it contains a lot of JSON documents.
It is true that MongoDB also allows you to store data in other formats e.g. using GridFS, but GridFS stores this data separately from your JSON collections. This is like BLOB storage in relational databases i.e. MongoDB doesn't know or care what's inside your files as it treats them simply as binary objects - so the file could contain image data, XML or indeed Microsoft Office data.
So, when you talk about storing Microsoft Word "documents" in MongoDB via GridFS, what you are really talking about is storing Word files as BLOBs (actually a set of BLOB chunks). MongoDB does not see these files as JSON documents, because they are not stored as JSON documents. You should probably read through the MongoDB documentation on GridFS to get a better understanding of what it does.
Finally, there is a "bindata" type that can be used for storing small volumes of binary data in-line within a JSON document, but I'm not sure when/how you would use this, and the binary data would still be a "black box" from MongoDB's perspective. Also, there is a size limit of 16MB for any JSON document stored within a MongoDB collection, so your binary data would have to be smaller than this limit.
No more Blub for me, thank you, Vicar.
posted 5 years ago
I understand now. You are right that I was confused that Document based data bases meant any document. Thanks for correcting.
It's never done THAT before. Explain it to me tiny ad: