Recently, I've run into an issue where I am unable to update the 'role' of a specific document. The document in question is a 'user' object within the MEANjs User schema, and it has a pre-defined property for roles. Here is the section of the schema concerning roles:
roles: {
type: [{
type: String,
enum: ['user','volunteer','participant','manager', 'admin']
}],
default: ['volunteer']
}
When attempting to update this field using a regular PUT request, the response comes back as OK (200) but no changes are reflected in the data. Surprisingly, when using the same method to update a custom field that I have created, it works perfectly fine.
Could this be related to the enum defined in the schema? Any ideas or suggestions would be greatly appreciated!
Thank you in advance!
PS - Just to note, the document's version (__v
) is not causing any issues in this scenario.