diff --git a/lib/ansible/modules/database/mongodb/mongodb_user.py b/lib/ansible/modules/database/mongodb/mongodb_user.py index e1a4849c8de..3b01c133370 100644 --- a/lib/ansible/modules/database/mongodb/mongodb_user.py +++ b/lib/ansible/modules/database/mongodb/mongodb_user.py @@ -383,8 +383,9 @@ def main(): client = MongoClient(**connection_params) # NOTE: this check must be done ASAP. - # We doesn't need to be authenticated. - check_compatibility(module, client) + # We doesn't need to be authenticated (this ability has lost in PyMongo 3.6) + if LooseVersion(PyMongoVersion) <= LooseVersion('3.5'): + check_compatibility(module, client) if login_user is None and login_password is None: mongocnf_creds = load_mongocnf()