osinka/subset2 — pull request #7 by kriomant (2013-06-25 16:37:51+00:00)
Title: Unify Field and DocParser

Currently there are two unrelated ways to parse: Field and DocParser. And in order to parse compound field you have to create parser and then create field which uses this parser.
But DocParser IS Field, it just accepts DBObject. So this change eliminates DocParser trait and uses Field everywhere. And Field returns not Option, but ParseResult, so it can report errors.

The cool things you can do now:

// implicit parser
implicit val parsePt = int("x") ~ int("y") map { case x ~ y => Pt(x, y) }
get[Pt]("pt") ~ ...

// explicit parser
get("pt")( int("x") ~ int("y") map { case x ~ y => Pt(x, y) }