Create the collection in Multi Tenancy on findOne #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Gentlemen, please accept my correction.
This is the case where explaining the problem is much more difficult than solving it. :)
I use ArangoDB with Multi Tenancy together with Spring Repository. I found that when querying a Collection that doesn't exist with FindOne, it returns that the collection doesn't exist. Which makes sense, but other things like the native findAll, create the collection instead of giving the error and return empty. So findOne, which should return an Optional .empty(), but it would return an Execption. Creating an inconsistency.
In this way, we had an inconsistency. Either it should always come back empty, or it should always come back Execption.
Well, the solution is just one line, do the Collection check within the custom find method. The creation of the Collection is already native if it does not exist when checking.
I also created a configuration class and a test class for using the repository. But they are completely optional.
Thank you very much for your attention.