prisma-client-go
prisma-client-go copied to clipboard
Need a function `NotExists()` for columns not present in MongoDB
I am using Prisma with MongoDB as the datasource and Go as the generator. Below is my setup:
datasource db {
provider = "mongodb"
url = env("MONGO_URI")
}
generator db {
provider = "go run github.com/steebchen/prisma-client-go"
}
model Company {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
address String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
deleted_at DateTime?
}
Currently, the following query works only when the deleted_at column is present and is null in MongoDB:
var params []db.CustomerWhereParam
params = append(params, db.Customer.DeletedAt.IsNull())
However, I need support for a query where the deleted_at column does not exist in MongoDB, like this raw query:
{
"deleted_at": { "$exists": false }
}
Proposed solution:
params = append(params, db.Customer.DeletedAt.NotExists())
Yeah this is currently missing, I will look into this.
internal note: The field should be isset like in the JS client.