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?
  "scope":"openid profile email",

Apologies if I am not making any sense.

I found a link I was trying to explain.

+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?