MongoDB – Arrays: {“Arrays” : [“Encourage flexibility”, “Do not enforce rigid structure]”}

One of the neat things I really like about MongoDB is the way it gracefully accommodates what I might term as semi or loosely structured data.

And, how data types can be mixed within an entity. Here X, Y & Z are all string datatypes, A is a numeric

{“X” : [“a”, “b”, “c”, “Y”, “Z”] }
{“Y” : [“a”, “b”, “c”] }
{“Z” : “Unknown”}
{“A” : 1}

In a traditional RDBMS, I’d have to create a column for every (data entry) eventuality and perhaps would end up with dozens, or hundreds of columns – some of them may be   sparsely populated, or close to completely null. Think about a mortgage application where a whole bunch of fields may be null if it’s a sole application, rather than a joint one.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s