After this change, the unique attributes must be unique for the entire MongoDB collection. Previously, they had to be unique only for the API resource. This becomes a problem when the datasource is configured with a filter and you have multiple resources sharing the same database collection.
At first we thought this was just a bug. However, in the mentioned commit a comment is introduced indicating that the change is in fact intentional:
we perform the check on the native mongo driver (and not on
app.data.find_one()) because in this case we don't want the usual
(for eve) query injection to interfere with this validation. We
are still operating within eve's mongo namespace anyway.
However, I fail to understand its motivation. Can you elaborate?
We don't use the soft-delete feature ourselves, but looking at the code, seems like it should also be affected (ie soft-deleted documents will be taken into account when validating the uniqueness of an attribute).
After this change, the unique attributes must be unique for the entire MongoDB collection. Previously, they had to be unique only for the API resource. This becomes a problem when the datasource is configured with a filter and you have multiple resources sharing the same database collection.
At first we thought this was just a bug. However, in the mentioned commit a comment is introduced indicating that the change is in fact intentional:
However, I fail to understand its motivation. Can you elaborate?
We don't use the soft-delete feature ourselves, but looking at the code, seems like it should also be affected (ie soft-deleted documents will be taken into account when validating the uniqueness of an attribute).