Pieter
11/01/2021, 2:05 PMCleberson Saller
11/01/2021, 2:40 PMDia TM
11/01/2021, 3:27 PMpostId
column? https://stackoverflow.com/questions/69776608/why-did-the-foreign-key-constraint-fail-on-the-column-postid I described the problem, but there is no answer.ut dev
11/01/2021, 4:53 PMerror - FetchError: invalid json response body at <http://localhost:3000/api/snippet> reason: Unexpected token < in JSON at position 0
error - TypeError: Do not know how to serialize a BigInt
friebetill
11/01/2021, 6:48 PMYaakov
11/01/2021, 6:52 PMYaakov
11/01/2021, 6:56 PMDanny
11/01/2021, 7:37 PMgenedy
11/01/2021, 8:30 PMgenedy
11/01/2021, 8:30 PMAustin Zentz
11/01/2021, 8:38 PMperp
11/02/2021, 8:39 AMRodrigo Oliveira
11/02/2021, 11:12 AMReuben Porter
11/02/2021, 11:49 AMdeleteMany
query where I have two where clauses, with one being an array of ids. For a basic example:
model SurveyPermission {
id
userId
surveyId
}
const userIds = ['1', '2', '3'];
const surveyId = 'survey-id';
delete many from surveyPermissions where surveyId === surveyId && userId === one of userIds array
I thought I could use has
but can't seem to get it working as I think that's just for enums.
Obviously I could do this in a loop and use a single delete but ideally wanted to handle it in a single query .user
11/02/2021, 12:48 PMJoshua Ramin
11/02/2021, 1:12 PMMateusz Żmijewski
11/02/2021, 1:18 PMJoshua Ramin
11/02/2021, 1:25 PMBård
11/02/2021, 1:44 PMmodel User {
id String @id @default(cuid())
name String?
email String? @unique
role Json @default("[ \"user\" ]")
emailVerified DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Account Account[]
Session Session[]
profile Profile?
seed Seed[]
weeklyWinner WeeklyWinners?
userQuestions UserQuestions[]
}
model UserQuestions {
id Int @id @default(autoincrement())
answer Json?
submitted Boolean? @default(false)
uid String
questionnaireId Int?
user User @relation(fields: [uid], references: [id])
questionnaire Questionnaire? @relation(fields: [questionnaireId], references: [id])
@@unique([uid, questionnaireId])
}
Considering these tables in my schema, i'm trying to get all users which have a relation to UserQuestions with the prop "submitted" to true.
This is my query:
prisma.user.findMany({
where: {
userQuestions: {
every: {
submitted: true,
},
},
},
select: {
email: true,
userQuestions: true,
name: true,
profile: true,
},
});
For some reason, this returns ALL users, including users who have no relation to UserQuestions. Any idea what is wrong here?Yaakov
11/02/2021, 2:45 PMmodel User {
id Int @id @default(autoincrement())
first_name String
last_name String
full_name String @calculated({first_name} + {last_name})
}
If not, is there any recommended convention for doing this?Kelly Copley
11/02/2021, 4:07 PMAlan
11/02/2021, 4:33 PMjruiseco
11/02/2021, 5:09 PMJeff Richie
11/02/2021, 5:15 PMJoshua Ramin
11/02/2021, 6:14 PMRodrigo Oliveira
11/02/2021, 7:14 PMRene Nielsen
11/02/2021, 10:33 PMgte
on a number.
I have some test documents, they contain a rating (number).
When i do a query that looks like this:
rating: {
gte: 3.5
}
I only get 5
results. Whereas im expecting 8
(Look at the list in the images).
If i do on the other hand make a small "hack" and subtract -00000.1 it works and i get 8. The 0.00001 was for testing, but confirmed my expectations.
rating: {
gte: 3.5-0.00001
}
If i do the query in mongodb shell i get 8
so its somewhere in the prisma client something is not doing as expected.
Im using prisma 3.3.0
with mongodbChris Tsongas
11/02/2021, 11:36 PMEthan Joffe
11/03/2021, 12:07 AMcreateMany
? What is the current best practice workaround?Nima
11/03/2021, 9:20 AM