Zhen
02/27/2022, 8:16 PMHenri Kuper
02/28/2022, 11:14 AM"code":"P2024","clientVersion":"3.6.0","meta":{"connection_limit":5,"timeout":10}
Because currently the client does not recover from this kind of error and I need to restart the whole server manually.
Would be a huge win already if I could simply catch the error and “restart/reset” only the prismaClient.
Thanks in advanceStian Bakken
02/28/2022, 2:40 PMmodel Match {
id String @id @default(uuid())
teamA Team @relation(name: "teamA", fields: [teamAId], references: [id])
teamB Team @relation(name: "teamB", fields: [teamBId], references: [id])
teamAId String @unique
teamBId String @unique
}
model Team {
id String @id @default(uuid())
match Match @relation(fields: [matchId], references: [id])
matchId String
}
If anyone has any better ways to model this or any ideas about how to solve it, I'd really appreciate it 🙂Juan Orellana
02/28/2022, 3:23 PMreturn this.prisma.user.findMany({
where: {
AND: [
if (searchUserDto.dni) { dni: { contains: searchUserDto.dni } },
if (searchUserDto.name) { name: { contains: searchUserDto.name} },
if (searchUserDto.surname) { surname: { contains: searchUserDto.surname} },
if (searchUserDto.email) { email: { contains: searchUserDto.email } },
if (searchUserDto.status) { status: { equals: searchUserDto.status.toString() != 'true' ? false : true } },
if (searchUserDto.bas_role_id) { bas_role_id: { equals: (searchUserDto.bas_role_id) } }
]
}
});Jonas Rothmann
02/28/2022, 5:28 PMPatrick
02/28/2022, 6:30 PMMatt Mueller (Prisma Client PM)
mongoDb preview feature flag:
prisma
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["mongoDb"]
}
Then you'll have a new type keyword in your Prisma Schema, for example:
prisma
model Order {
id String @id @default(auto()) @map("_id") @db.ObjectId
product Product @relation(fields: [productId], references: [id])
color Color
size Size
shippingAddress Address
billingAddress Address?
productId String @db.ObjectId
}
// New composite type!
type Address {
street String
city String
zip String
}
Once you run prisma generate, you'll have a new type-safe API for working with these types.
For example, here's how you'd create a new Order with an embedded shipping address:
ts
const order = await prisma.order.create({
data: {
// Normal relation
product: { connect: { id: 'some-object-id' } },
color: 'Red',
size: 'Large',
// Composite type
shippingAddress: {
street: '1084 Candycane Lane',
city: 'Silverlake',
zip: '84323',
},
},
})
This is just the tip of the iceberg. Dive deeper in our documentation.
---
If you have any feedback for us, I'd love to jump on a call with you.
We're actively working towards getting MongoDB production ready, so now's the time to give this a try and share your thoughts!mxstbr
03/01/2022, 7:50 AM// the correct form of comments in the schema.prisma file?Adrian
03/01/2022, 9:36 AMAdrian
03/01/2022, 9:39 AMGeebrox
03/01/2022, 10:48 AMerror: Property not known: "activeProvider".
--> schema.prisma:4
|
3 | provider = "mongodb"
4 | activeProvider = "mongodb"
5 | url = env("DATABASE_URL")
|Zefex Developer
03/01/2022, 12:52 PMconst tags = await prisma.tag.findMany({
where: {
users: {
every: {
user: {
id
}
}
}
}
})Michael Stewart
03/01/2022, 1:36 PMserverless-plugin-typescript ? 🙂Utsav Shah
03/01/2022, 4:53 PMaj
03/01/2022, 7:18 PMZefex Developer
03/02/2022, 12:03 AMprisma.user.update({
where: { id: '' },
data: {
name: 'John Doe',
tags: {
connect: {
tagId_userId: {
tagId: '',
userId: ''
}
}
}
}
})
I didn't want to repeat the userId especially because I'm going to be asking as an input for the user. Is there another way of doing that? In resume, is there a way to only specify the tag ids instead of the userId over and over again?David
03/02/2022, 3:02 AMDeepak Guptha S
03/02/2022, 8:57 AMSELECT *
FROM employees
WHERE DATEDIFF(hire_date, STR_TO_DATE('2021-01-01', '%Y-%m-%d')) >= 0
Anyone has the solution for it ?Peter Takacs
03/02/2022, 2:41 PMVignesh T.V.
03/02/2022, 5:00 PM@@unique([field1, field2], name: "key")
Now, is it possible to relate to key from other models like @relation(fields: [field3], references: [key])
Currently it says that I can only map to fields that exist if I do thisJohnson Detlev
03/02/2022, 6:20 PMMoe Green
03/02/2022, 6:23 PMSELECT * FROM users WHERE email = '<mailto:ccc@gmail.com|ccc@gmail.com>' AND username = 'ccc' in Prisma?Juan Orellana
03/02/2022, 8:08 PMDamian M
03/03/2022, 4:02 AMFauziya Shaikh
03/03/2022, 7:18 AM> npx prisma generate
#30 0.243
#30 4.198 Prisma schema loaded from prisma/schema.prisma
#30 4.352 Error: Get config: Error: Command failed with ENOENT: /usr/local/lib/node_modules/prisma/query-engine-linux-arm-openssl-1.1.x cli get-config --ignoreEnvVarErrors
#30 4.352 spawn /usr/local/lib/node_modules/prisma/query-engine-linux-arm-openssl-1.1.x ENOENTKapil Sharma
03/03/2022, 8:33 AMError: Error in connector: Authentication failed for user 'myuser'
Our connection string is created like:
DATABSE_URL="<sqlserver://HOST>:PORT;database=DB_NAME;username=DB_USER;password=DB_PASSWORD;integratedSecurity=true;trustServerCertificate=true"
Has anyone tried connecting to Azure SQL server using Azure Active Directory Password authentication in Prisma?Kapil Sharma
03/03/2022, 8:36 AMoptions: {dialect, authentication: {type: 'azure-active-directory-password'}} .
Is it even feasible in Prisma?shahrukh ahmed
03/03/2022, 12:55 PMezeikel
03/03/2022, 3:25 PM_.count: { select: {...} } with a filter like you can in prisma.x.count()? this is to allow ignoring records marked as deleted in the count for example
2. Has anyone else experienced an issue with using field count in combination with a filter on a relation in findMany e.g. get me all of the posts for a specific user but also but also give me a count of x field? - this causes a really slow query for me averaging about 25s and removing the user filter OR the _.count gets the time taken back down to ~1s?
(using mongo connecter btw)Casey Chow
03/03/2022, 11:29 PMError occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: FromSql(6), cause: Some(WasNull) }) })