![](/img/trans.png)
[英]I want to add a hotspot to certain parts of the obj extension model I have installed with three.js. how can I do it?
[英]i'm using nest js and mongodb with prisma and i want to add three collection in how can i do?
我想添加三個 model 的 prisma 就像。 模式.prisma
model women{
id string @id @default(auto()) @map("_id") @db.ObjectId
womenname: string;
womengender: string
womendob: string
womenincome: string
}
model men{
id string @id @default(auto()) @map("_id") @db.ObjectId
malename: string;
malegender: string
maledob: string
maleincome: string
}
model child{
id string @id @default(auto()) @map("_id") @db.ObjectId
childname: string;
childgender: string
childdob: string
}
我如何將這三個 model 添加到一個 model 中。就像這樣。
model information{
male: //male model data,
women: // women model data,
child: //child model data
}
Prisma 的文檔中已經對此進行了描述,您有兩種選擇
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
tasks Task[]
}
model Task {
id String @id @default(auto()) @map("_id") @db.ObjectId
user Product @relation(fields: [userId], references: [id])
userId String @db.ObjectId
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
tasks Task[]
}
// This will not be a different collection but it will work as "rules" or schema for the attributes inside the user.tasks property
type Task {
title String
description String
}
使用最后一個示例,您將擁有類似的東西
// users document
{
"_id": "SOME RANDOM ID",
"tasks": [
{
"title": "SOME TITLE",
"description": "SOME DESCRIPTION"
}
]
}
您也可以嘗試在此處更深入地查看文檔https://www.prisma.io/docs/concepts/components/prisma-client/composite-types
我希望它有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.