arguments:[{document:'The document being inserted'},{currentUser:'The current user'},{validationErrors:'An object that can be used to accumulate validation errors'}],
runs:'sync',
returns:'document',
description:`Validate a document before insertion (can be skipped when inserting directly on server).`
});
registerCallback({
name:`${collectionName}.new.before`,
arguments:[{document:'The document being inserted'},{currentUser:'The current user'}],
runs:'sync',
returns:'document',
description:`Perform operations on a new document before it's inserted in the database.`
});
registerCallback({
name:`${collectionName}.new.after`,
arguments:[{document:'The document being inserted'},{currentUser:'The current user'}],
runs:'sync',
returns:'document',
description:`Perform operations on a new document after it's inserted in the database but *before* the mutation returns it.`
});
registerCallback({
name:`${collectionName}.new.async`,
arguments:[{document:'The document being inserted'},{currentUser:'The current user'},{collection:'The collection the document belongs to'}],
runs:'async',
returns:null,
description:`Perform operations on a new document after it's inserted in the database asynchronously.`
arguments:[{modifier:'The MongoDB modifier'},{document:'The document being edited'},{currentUser:'The current user'},{validationErrors:'An object that can be used to accumulate validation errors'}],
arguments:[{newDocument:'The document after the edit'},{document:'The document before the edit'},{currentUser:'The current user'},{collection:'The collection the document belongs to'}],
description:`Perform operations on a document after it's updated in the database asynchronously.`
});
registerCallback({
name:`${collectionName}.remove.validate`,
arguments:[{document:'The document being removed'},{currentUser:'The current user'},{validationErrors:'An object that can be used to accumulate validation errors'}],
runs:'sync',
returns:'document',
description:`Validate a document before removal (can be skipped when removing directly on server).`
});
registerCallback({
name:`${collectionName}.remove.before`,
arguments:[{document:'The document being removed'},{currentUser:'The current user'}],
runs:'sync',
returns:null,
description:`Perform operations on a document before it's removed from the database.`