I have lot's of data in `json` file How do i send ...
# orm-help
n
I have lot's of data in
json
file How do i send mutation?
r
@nikunj chaudhari 👋 You would need to construct the data in the mutation similar to what Prisma accepts.
n
@Ryan Do u have any reference?
r
Can you share your use case with an example of data that you have and the mutation so that I can provide the correct implementation.
n
Okay. Give me minute
👍 1
@Ryan my prisma model
Copy code
model Mobile {
  id                   Int            @id @default(autoincrement())
  brand                Company?       @relation("Mobile_brand", fields: [brandId], references: [id])
  brandId              Int?           @map("brand")
  name                 String?
  image                Image[]        @relation("Image_mobile")
  affilate             AffilateLink[] @relation("AffilateLink_mobile")
  launchAnnounced      String?
  launchStatus         String?
  mainCamera           String?
  mainCameraSingle     String?
  mainCameraDual       String?
  mainCameraTriple     String?
  mainCameraFour       String?
  mainCameraFive       String?
  mainCameraVideo      String?
  mainCameraFeature    String?
  selfieCamera         String?
  selfieCameraSingle   String?
  selfieCameraDual     String?
  selfieCameraTriple   String?
  selfieCameraFeatures String?
  selfieCameraVideo    String?
  platformChipset      String?
  playformCpu          String?
  platformGpu          String?
  platformOs           String?
  battery              String?
  batteryCharging      String?
  batteryMusicPlay     String?
  batteryTalkTime      String?
  batteryStandBy       String?
  displayType          String?
  displaySize          String?
  displayResolution    String?
  display              String?
  displayProtection    String?
  body                 String?
  height               Float?
  width                Float?
  thickness            Float?
  bodyweight           Int?
  bodySim              String?
  bodyBuild            String?
  bodyKeyboard         String?
  memory               String?
  memoryInternal       String?
  network              String?
  networkTechnology    String?
  networkTwoG          String?
  networkThreeG        String?
  networkFourG         String?
  networkFiveG         String?
  networkGprs          String?
  networkEdge          String?
  networkSpeed         String?
  commsWlan            String?
  commsBluetooth       String?
  commsGps             String?
  commsRadio           String?
  commsNfc             String?
  commsInfraredPort    String?
  soundLoudspeaker     String?
  soundThree           String?
  soundAlertType       String?
  featureSensors       String?
  featuresMessaging    String?
  featuresBrowser      String?
  featuresClock        String?
  featuresAlarm        String?
  featuersGame         String?
  featuresJava         String?
  features             String?
  miscColors           String?
  miscModel            String?
  miscPrice            String?
  miscSarEu            String?
  miscSar              String?
  memoryCardSlot       String?
  memoryPhoneBook      String?
  memoryCallRecords    String?
  testsPerformance     String?
  testsCamera          String?
  testsLoudspeaker     String?
  testsAudioQuality    String?
  testsBatteryLife     String?
  testsDisplay         String?

  @@index([brandId])
}
and my data is also similer
Copy code
[
{
  "brand":"brand name",
  "mobile":"mobile name",
...
   "test display":"some data"
},
{
  "brand":"brand name",
  "mobile":"mobile name",
...
   "test display":"some data"
},
]
something just like this
Hey @Ryan any idea?
r
In this case, you would need to map the items to the structure Prisma supports. For e.g. The key
brand
would become:
Copy code
brand: { connectOrCreate: { // brand data } }
So you would need to map the relevant relations in that manner. The fields of the same model would stay as is.
n
Thanks . I will try that
💯 1