Describe the bug
I am unable to set a unique field to null in a mutation.
To Reproduce
Steps to reproduce the behavior:
Create a database type with a @unique constraint
Create an object with that field explicitly set to null
Create another object with the same field explicitly set to null
See error
error
...
"message": "A unique constraint would be violated on User. Details: Field name = email"
...
datamodel.prisma
type User {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
email: String @unique
}
docker-compose.yml
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.34
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
# uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
# managementApiSecret: my-secret
databases:
default:
connector: mongo
uri: 'mongodb://prisma:prisma@mongo'
mongo:
image: mongo:3.6
restart: always
# Uncomment the next two lines to connect to your your database from outside the Docker environment, e.g. using a database GUI like Compass
# ports:
# - "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: prisma
MONGO_INITDB_ROOT_PASSWORD: prisma
volumes:
- mongo:/var/lib/mongo
volumes:
mongo:
Expected behavior
As mentioned in the documentation "The only exception is the null value, meaning that multiple nodes can have the value null without violating the constraint."
However, when null is set explicitly to multiple objects it violates the unique constraint
Versions (please complete the following information):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
Describe the bug I am unable to set a unique field to null in a mutation.
To Reproduce Steps to reproduce the behavior:
@unique
constraintnull
null
error
datamodel.prisma
docker-compose.yml
Expected behavior As mentioned in the documentation "The only exception is the null value, meaning that multiple nodes can have the value null without violating the constraint."
However, when null is set explicitly to multiple objects it violates the unique constraint
Versions (please complete the following information):
MongoDB
1.34.0
prisma
CLI:prisma/1.34.0 (darwin-x64) node-v10.4.1
OS X High Sierra