diff --git a/packages/nova-lib/lib/mutations.js b/packages/nova-lib/lib/mutations.js index f6ef429ca..c9749a8c8 100644 --- a/packages/nova-lib/lib/mutations.js +++ b/packages/nova-lib/lib/mutations.js @@ -71,7 +71,9 @@ export const newMutation = ({ collection, document, currentUser, validate, conte document = runCallbacks(`${collectionName}.new.sync`, document, currentUser); // add _id to document - document._id = collection.insert({...document}); // use {...document} to "enable" Object.prototype (see https://cl.ly/1N1m2d0y3u1A) + // note: use {...document} to "enable" Object.prototype (see https://cl.ly/1N1m2d0y3u1A) + // see https://github.com/aldeed/meteor-collection2-core/issues/8 + document._id = collection.insert({...document}); // get fresh copy of document from db const newDocument = collection.findOne(document._id); @@ -108,14 +110,11 @@ export const editMutation = ({ collection, documentId, set, unset, currentUser, // check that the current user has permission to edit each field const modifiedProperties = _.keys(set).concat(_.keys(unset)); modifiedProperties.forEach(function (fieldName) { - var field = schema[fieldName]; - console.log(field); + const field = schema[fieldName]; if (!context.Users.canEditField(currentUser, field, document)) { throw new Meteor.Error('disallowed_property', `disallowed_property_detected: ${fieldName}`); } }); - - console.log(modifier); // validate modifier against schema collection.simpleSchema().namedContext(`${collectionName}.edit`).validate(modifier, {modifier: true});