Skip to content

Atomic operations are not validated, _id is different, createdOn and updatedOn is not generated #51

@alldayalone

Description

@alldayalone

I need to use upsert and $setOnUpsert to provide idempotency based on unique external id. It is not possible with the regular update/findOneAndUpdate but with atomic I got problems described in the title

cardService.atomic.findOneAndUpdate({ cardProxy }, ({
    $set: _.omit(card, ['_id', 'cardProxy']),
    $setOnInsert: { _id: cardService.generateId() },
  }), { upsert: true });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions