masylum / mongolia

Flexible non-magical layer for the nodejs MongoDB driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recursive `namespacing` and `mapping`

masylum opened this issue · comments

I think it would be nice to allow deeper attributes, so we could have:

User.maps = {
  email: String
, posts: {
    count: Number
  , titles: function (val) {
      return val.join(', ');
    }
  }
};
User.namespaces = {
  post_form: ['email', 'post.titles']
, post_admin: ['post']
}