I am working with a Meteor schema that has a field defined as below:
export const MyCollectionSchema = new SimpleSchema({
myField: {
optional: true,
type: String,
},
...
});
We have also attached the behavior below:
export const MyCollection = new Meteor.Collection('my_collection');
MyCollection.deny({
insert: () => true,
update: () => true,
remove: () => true,
});
MyCollection.attachBehaviour('timestampable', {
createdAt: 'insertedAt',
createdBy: 'insertedBy',
updatedAt: 'modifiedAt',
updatedBy: 'modifiedBy',
});
MyCollection.attachSchema(MyCollectionSchema);
I am trying to update an existing item with this call:
MyCollection.update(
{ _id: myId },
{ $set: {
myField: myFieldValue,
modifiedAt: new Date().toString(),
modifiedBy: userId,
} },
);
But it keeps failing because of regex validation failure:
(Error: Modified by failed regular expression validation in my_collection update)
I am not using regex in here and am not super familiar with meteor so am not sure if I should be using regex here. Help :/