Attribute-Based Property Aliases Using MongoDB and NoRM

Since MongoDB is a document database, collections don’t have an enforced schema. Each document in a collection needs to store the names of all of its properties, making the length of that name more significant. Using abbreviated property names helps cut down on the storage space needed for each document, but it’s not ideal to mirror those abbreviated names in your object model. To help solve this problem, the NoRM driver provides an easy mechanism for defining custom mappings between the document and your model. First I’ll go through the standard way of doing it, and then I’ll present a custom solution that helps cut down on the amount of code you have to write by using attributes.

READ MORE

Tags: , ,