UpdateOperation

Operation defaults are dryRun(false), grant(null), lean(true), skipAcl(false).

dryRun(bool = true)
execute()
grant(level)
lean(bool = true)
skipAcl(bool = true)

const Items = org.objects.c_items;

const _id = Items.updateOne({c_key: 'unique key'}, {c_key: 'very unique'})
  .skipAcl()
  .grant(consts.accessLevels.update)  
  .execute();
  
return Items.find({_id: _id}).paths('c_key').next();

UpdateOperation.dryRun(bool = true)

The operation performs a dry run. Though no documents are updated, before triggers are called.

Arguments

  • bool (Boolean)

Returns

this

UpdateOperation.execute()

Executes the operation.

Returns

ObjectID|Object If the lean option is turned off, the entire updated document is returned. When true, only the identifier is returned.

UpdateOperation.grant(level)

Sets the grant level for the operation.

Arguments

  • level (Number)

Returns

this

UpdateOperation.lean(bool = true)

On by default, turning off this option reads the entire updated document after execution.

Arguments

  • bool (Boolean)

Returns

this

UpdateOperation.skipAcl(bool = true)

Skips property acl checks.

Arguments

  • bool (Boolean)

Returns

this