InsertOperation

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

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

const Items = org.objects.c_items;

const _id = Items.insertOne({c_key: 'unique key'}).execute();
  
return Items.find({_id: _id}).paths('c_key').next();

InsertOperation.bypassCreateAcl(bool = true)

Skips createAcl checks.

Arguments

  • bool (Boolean)

Returns

this

InsertOperation.dryRun(bool = true)

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

Arguments

  • bool (Boolean)

Returns

this

InsertOperation.execute()

Executes the operation.

Returns

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

InsertOperation.grant(level)

Sets the grant level for the operation.

Arguments

  • level (Number)

Returns

this

InsertOperation.lean(bool = true)

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

Arguments

  • bool (Boolean)

Returns

this

InsertOperation.skipAcl(bool = true)

Skips acl checks.

Arguments

  • bool (Boolean)

Returns

this