Mongodb (version 3.2) create user error addUser is not a function

When creating a user from the MongoDB command line, the following error is reported:
2016-11-04T19:41:02.563+0800 E QUERY [thread1] TypeError: db.addUser is not a function:

The addUser() method is no longer supported in the mongdb3.x version and is replaced by the createUser() method.

See the section on creating users in the official documentation:

When you add a new user, you can specify the user’s role. Refer to the built-in roles section of the official documentation: (with Chinese translation)

Also refer to the blog post:

Read More: