factored bson/document into a cpp file