Loopback inserts object id values for my MongoDB as sequence and not random. for security reason, how can i change it to be random by default for all my models?
Will it affect the DB performance?
You can change the way the ID is generated in the description file of your model: https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html#properties
model.json:
{
"name": "model",
"base": "PersistedModel",
"strict": true,
"idInjection": false, // disable default id!
"properties": {
"id": {
"id": true,
"required": true,
"type": "string",
"defaultFn": "uuid" // "guid" / "uuid" / "uuidv4" / "now"
},
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}