mongodb cart: clean up `mongodb_context`

Integrating Miciah's suggestions to simplify `update_configuration` -
smarter path element generation and more correct handling for empty
`ld_path` variables