Skip to content

Unique constraints appearantly not checked when updating document #151

@xyrus02

Description

@xyrus02

Given a NitriteCollection labeled list exists, for which there is a unique index for field "Data"
Given a document labeled 1 exists in the collection list with field "Data" = "test"
Given another document labeled 2 exists in the collection list with field "Data" = "test2"

[ { "_id": 1, "Data": "test"}, { "_id": 2, "Data": "test2"} ]

Reproduction steps: 2 would be updated so that "Data" changes to "test" knowing that the same value already exists on 1 and would violate the unique constraint. This would be achived by fetching 2 from the collection, setting "Data" to test and attempting to call update on the collection to store the changes.

Expectation: an exception is raised similar to a scenario where a third document with "Data" = "test" would be inserted.

Observation: no exception is raised. The change is stored and now the value "test" is not unique anymore within list - despite the unique constraint.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions