This is what I got:
[ { _id: 'uMZvSKXoyPDK5ZjGa',
createdAt: 2019-06-26T03:54:19.304Z,
services: { password: [Object], resume: [Object] },
username: 'Kuroki' },
{ _id: 'omJ7e676Kf9pYCkmm',
createdAt: 2019-08-07T00:20:12.618Z,
services: { password: [Object], resume: [Object] },
username: 'nah' },
{ _id: 'edyHtHx9RpWgN6Spx',
createdAt: 2019-08-07T00:34:46.477Z,
services: { password: [Object], resume: [Object] },
username: 'test' },
{ _id: 'wc3BakQCMCCBTfn6y',
createdAt: 2019-08-07T00:54:37.416Z,
services: { password: [Object], resume: [Object] },
username: 'test5' } ]
All accounts, except Kuroki were created after I inserted the onCreateUser function. Is it possible that the whole user-collection has to be empty in order to work? Because the new field is somehow interfering with old documents which don’t have the the new field?
I have considered the roles-package - I actually installed it but since all I need, I think, is just a role-field with a string to determine which users can access special content like a adminpanel and such. But I might go there if I can’t figure out onCreateUser.