AWS Cognito JWT sub , can it used as userid?

  1. Well, I have seen some web app using ObjectID as a sub in jwt, i.e, to say as user_id. is it any bad?
  2. What’s the recommended way to have user_id since it’s a primary key.
    a) As ObjectID since it’s optimized for querying.
    b) As a random string “asdfasdajsadjfhasdf” which is indexed
    c) As UUID “1f0be62f-ffcd-49ca-b5a4-18f0bf62e0e6”
    What’s the correct way to proceed. Since I am using AWS Cognito which spits out jwt token which has “sub” field as a unique ID. Hence I have no options left but to use this “sub”: “bb8bade7-2514-4152-8a41-a1524bf43f21” as user_id. Any performance issues with this?
{  
  "sub":"1f0be62f-ffcd-49ca-b5a4-18f0bf62e0e6",
  "token_use":"access",
  "scope":"openid profile https://cognito-demo-api.asdas.com/hello-world.all email",
  "auth_time":1565020449,
  "iss":"https://cognito-idp.eu-west-2.amazonaws.com/eu-west-2_z1Go5XdrZ",
  "exp":1565024049,
  "iat":1565020449,
  "version":2,
  "jti":"bb8bade7-2514-4152-8a41-a1524bf43f21",
  "client_id":"4tnp4k64d5v4ah9dud3pj1kbs0",
  "username":"asda"
}

Apologies if I am not making any sense.

I found a link I was trying to explain. https://thinkster.io/tutorials/node-json-api/creating-the-user-model

+UserSchema.methods.generateJWT = function() {
+  var today = new Date();
+  var exp = new Date(today);
+  exp.setDate(today.getDate() + 60);
+
+  return jwt.sign({
+    id: this._id,
+    username: this.username,
+    exp: parseInt(exp.getTime() / 1000),
+  }, secret);
+};

mongoose.model('User', UserSchema);

Is there anyone who is doing like this ( id: this._id, ) in production?