MongoDB for Custom Data Fields
We have an application that contains a mix of relational data and dynamically structured data. All of the data is currently stored in SQL Server, with the dynamic portion of the data models being stored in string columns as json data. If all we needed to do with the non-relational data was to display it on various screens, SQL Server would work great.
The trouble however, is that we need to search and filter on the json data. This is something SQL Server cannot help with, because it treats the json data as one big string and has no knowledge of the underlying structure of the json data.
The json data has structure, but the structure can vary for each data element. There is a class of databases commonly referred to as “No-SQL” which are built to handle exactly this kind of fluid data structure.
We decided to use MongoDb because:
It can solve our problem
We have used MongoDb before
It is free
MongoDb is one of the most heavily used databases right now, which means it is very easy to find answers to questions (Stackoverflow, the MongoDb site, Twitter etc.) should the need arise.
Specifically, our solution will be to move just the data entities that have the dynamic structure into MongoDb, but leave the other static data in SQL Server. This will allow us to maximize the benefit of using MongoDb without forcing the entire database into MongoDb.
Learn more about the apps we build.