Open your MongoDB shell and execute the following:
use OrderBase; db.createCollection('User'); db.createCollection('Role'); db.createCollection('AccessToken');
This will create the necessary collections that we need to store users and their roles and tokens. The new documents will have the following structure:
User: { firstName, lastName, email, roleID, password }
For now, we will not add any users or tokens (this comes later when we extend the API), but we will add the roles that we are going to use. To keep it simple, we will just have two of them:
It is understood that default ObjectID
generated by MongoDB will be included in the preceding code. For the access token...