Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introspecting indexes on embedded documents leads to validation error #12449

Closed
Tracked by #8788
janpio opened this issue Mar 21, 2022 · 1 comment
Closed
Tracked by #8788

Introspecting indexes on embedded documents leads to validation error #12449

janpio opened this issue Mar 21, 2022 · 1 comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: mongodb topic: validation
Milestone

Comments

@janpio
Copy link
Member

janpio commented Mar 21, 2022

Currently indexes on fields of embedded documents lead to creation of a not really existing field in the parent model, and an index on that. The index uses a dot in its name, which is not allowed right now.

This should go away when we actually support indexes on embedded document fields via #10101

Error: Schema parsing
error: Error parsing attribute "@map": The field name cannot contain a `.` character
  -->  schema.prisma:123
   | 
122 |   /// Field referred in an index, but found no data to define the type.
123 |   address_location      Json?                          @map("address.location")
   | 

Validation Error Count: 1
Error: Schema parsing
error: Error parsing attribute "@map": The field name cannot contain a `.` character
  -->  schema.prisma:113
   | 
112 |   /// Field referred in an index, but found no data to define the type.
113 |   location_geo Json?            @map("location.geo")
   | 

Validation Error Count: 1

Underlying models:

model listingsAndReviews {
  id                    String                         @id @map("_id")
  access                String
  accommodates          Int
  address               ListingsAndReviewsAddress
  amenities             String[]
  availability          ListingsAndReviewsAvailability
  bathrooms             Decimal?
  bed_type              String
  bedrooms              Int?
  beds                  Int?
  calendar_last_scraped DateTime                       @db.Date
  cancellation_policy   String
  cleaning_fee          Decimal?
  description           String
  extra_people          Decimal
  first_review          DateTime?                      @db.Date
  guests_included       Decimal
  host                  ListingsAndReviewsHost
  house_rules           String
  images                ListingsAndReviewsImages
  interaction           String
  last_review           DateTime?                      @db.Date
  last_scraped          DateTime                       @db.Date
  listing_url           String
  maximum_nights        String
  minimum_nights        String
  monthly_price         Decimal?
  name                  String
  neighborhood_overview String
  notes                 String
  number_of_reviews     Int
  price                 Decimal
  property_type         String
  review_scores         ListingsAndReviewsReviewScores
  reviews               ListingsAndReviewsReviews[]
  reviews_per_month     Int?
  room_type             String
  security_deposit      Decimal?
  space                 String
  summary               String
  transit               String
  weekly_price          Decimal?
  /// Field referred in an index, but found no data to define the type.
  address_location      Json?                          @map("address.location")

  @@index([property_type, room_type, beds], map: "property_type_1_room_type_1_beds_1")
  @@index([name], map: "name_1")
  @@index([address_location], map: "address.location_2dsphere")
}
model theaters {
  id           String           @id @default(auto()) @map("_id") @db.ObjectId
  location     TheatersLocation
  theaterId    Int
  /// Field referred in an index, but found no data to define the type.
  location_geo Json?            @map("location.geo")

  @@index([location_geo], map: "geo index")
}
@janpio janpio added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. topic: validation team/schema Issue for team Schema. topic: mongodb labels Mar 21, 2022
@janpio janpio added this to the 3.12.0 milestone Mar 21, 2022
@janpio janpio added the tech/engines Issue for tech Engines. label Mar 24, 2022
@janpio janpio closed this as completed Apr 1, 2022
@janpio
Copy link
Member Author

janpio commented Apr 1, 2022

Solved via #10101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines Issue for tech Engines. topic: mongodb topic: validation
Projects
None yet
Development

No branches or pull requests

1 participant