// Add super user
conn = new Mongo();
db = conn.getDB("admin");
db.auth( '{{ MONGO_ADMIN_USER }}', '{{ MONGO_ADMIN_PASSWORD }}');

if(db.getUser('{{ MONGO_ADMIN_USER }}') == null) {
    db.createUser(
        {
            "user": "{{ MONGO_ADMIN_USER }}",
            "pwd": "{{ MONGO_ADMIN_PASSWORD }}",
            "roles": ["root"]
        }
    );
} else {
    db.updateUser(
        "{{ MONGO_ADMIN_USER }}",
        {
            "pwd": "{{ MONGO_ADMIN_PASSWORD }}",
            "roles": ["root"]
        }
    );
}

