the id can be anything you assign it, but its convenient you use the generic id which mongo assigns.
For example this requirement:
You can POST to /api/users with form data username to create a new user. The returned response will be an object with username and _id properties.
The user POST with data username. You create a document with that username in mongo. The document will automatically acquire a prop _id. You can then return that object in the response, containing the username and _id.