Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
On shortened field names in MongoDB (boxedice.com)
3 points by dmytton on Oct 23, 2010 | hide | past | favorite | 2 comments


I'll further focus on one point in the post: The author took it as a given that the code with short column names was "less readable". Why? Surely he wasn't repeating the literal field names again and again in the code?

In the last DB-intensive project I worked on, we used constants in the code that had to deal with column names. This was extremely useful when changing our database schema -- no names to hunt down and change, just change the name in the one place it was used in the code.

In this case, this method gives you both a readable name in your code and a short name to repeat in the DB.

Just a thought.


This Mongo console is pretty useful for poking around in your data during development. Usable field names help there.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: