How do I define a unique constraint on nested field? The following is throwing an invalid field path error:
collection Account {
user: Ref<User>
socialProvider: {
name: "Github" | "Google" | "Facebook"
userId: String
email: String
}?
passkey: {
publicKey: String
algorithmId: Long
passkeyId: String
}?
unique [.user, .socialProvider?.name]
unique [.passkey?.passkeyId]
}
› Error: error: Invalid field path
› at src/lib/db/schema/fsl/collections/account.fsl:14:35
› |
› 14 | unique [.user, .socialProvider?.name]
› | ^^^^^^
› |
› error: Invalid field path
› at src/lib/db/schema/fsl/collections/account.fsl:15:21
› |
› 15 | unique [.passkey?.passkeyId]
› | ^^^^^^^^^^^
› |
It would be also helpful if this topic would be covered directly in the docs: FSL collection schema: Unique constraint definitions - Fauna Docs