Portable business logic of MongoDB security model, mostly string formatting