I have had an elaborated check picked here and there on my ansible playbook to check whether authentication is enabled on mongo and it seems it doesn't work any longer with 4.0. Up to now it always works as expected.
/usr/bin/mongo --eval 'db.getUsers()' $1 | grep 'not auth' | grep -P "usersInfo:\s+\d\.\d" -o
Off late this returns nothing. So I wanted to cross check the facts. I found this stackoverflow post with similar commands.
I have run it as well and it shows that auth is not enabled meanwhile is it.
Below is the output of that experiment.
I have not found anything specific to how to do this differently on 4.0 so I am wondering if anybody knows how to get this done in 4.0.