Fix checking mongoid configuration and fix indexing errors

Signed-off-by: Jorge Cuadrado <kuadrosxx@gmail.com>