only modify mongoid if it is used

Signed-off-by: Zeljko <zeljko@zwr.fi>