Open RemyMachado opened 2 years ago
No reason I know of. Batching and caching should work with your helper
Not that I think it's necessary, but one major use case for this would be authenticated queries where it's necessary to identify the user trying to access the document.
Example:
async findOneByFields(documentId, userId) {
return this.findByFields({ _id: documentId, userId }).then(documents => documents?.[0]);
}
I am wondering why isn't there a
findOneByFields
method, similar to the existingfindByFields
one.Currently I'm using this hack:
Is there a reason why it's not provided?
Is my wrapping function useless because of how the batching/caching work?