I accidentally merged this, so I reverted it, then made a new PR. The new PR is here: https://github.com/prisma/docs/pull/3722
This docs work is done, but we need to wait until the feature actually foes out. We will need to update the version numbers in the text to [whatever version this goes into]
SME: Cristian, Daniel
Cristian and Dan have reviewed it; however, we can't merge this, because there are issues with it. Also note that we still mention 4.3, and this didn't go out with that version, so we'll need to update it.
Incidentally, we should ensure we link to these examples from our main findUnique entry (if we don't already), because we don't go into this amount of detail there.
MongoDB has embedded documents. We currently don't support findUniques with them. With this new feature, composite findUniques work with MongoDB embedded types.
With this feature, you can findUnique on embedded documents, as follows:
So if we want to find records with a unique attribute that is a combination of name, location.address and cost (a bit of a wacky example - we might be able to come up with a better one for the doc), our app code might be as follows:
Update 05 Sep 2022:
I accidentally merged this, so I reverted it, then made a new PR. The new PR is here: https://github.com/prisma/docs/pull/3722 This docs work is done, but we need to wait until the feature actually foes out. We will need to update the version numbers in the text to [whatever version this goes into]
SME: Cristian, Daniel
Cristian and Dan have reviewed it; however, we can't merge this, because there are issues with it. Also note that we still mention 4.3, and this didn't go out with that version, so we'll need to update it.
This is NOT a preview feature
Eng ticket: https://github.com/prisma/prisma/issues/12409
Notion discussion: https://www.notion.so/prismaio/Proposal-Composite-Field-Indices-03baf2ea1865417684fdab7fda2ee007
See this section on Docs notes: https://www.notion.so/prismaio/Proposal-Composite-Field-Indices-03baf2ea1865417684fdab7fda2ee007 (the naming there is pretty convuluted)
This change relates to MongoDB only
It allows findUniques inside MongoDB embedded types
Notes:
Our docs here currently giv an example of composite findUniques as they work now:
Incidentally, we should ensure we link to these examples from our main findUnique entry (if we don't already), because we don't go into this amount of detail there.
MongoDB has embedded documents. We currently don't support findUniques with them. With this new feature, composite findUniques work with MongoDB embedded types.
With this feature, you can findUnique on embedded documents, as follows:
In the schema:
So if we want to find records with a unique attribute that is a combination of name, location.address and cost (a bit of a wacky example - we might be able to come up with a better one for the doc), our app code might be as follows: