c++ code tweaks
updating tests
updates; fixing issues with mongo error reporting and metadata fields