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

Preview feature feedback: MongoDB support (mongoDb) #8241

Closed
matthewmueller opened this issue Jul 13, 2021 · 12 comments
Closed

Preview feature feedback: MongoDB support (mongoDb) #8241

matthewmueller opened this issue Jul 13, 2021 · 12 comments
Labels
kind/feedback Issue for gathering feedback. team/client Issue for team Client. topic: mongodb topic: previewFeatures Issue touches on an preview feature flag
Milestone

Comments

@matthewmueller
Copy link
Contributor

Please share your feedback about the mongoDb functionality released in v2.27.0 in this issue.

  • If you encounter a bug, please open a bug report in this repo.
  • If the feature is working well for you, please share this in a comment below or leave a 👍 on this issue.

If you have any questions, don't hesitate to ask them in the #prisma-client channel in the Prisma Slack.

@timleslie

This comment was marked as outdated.

@janpio janpio added topic: mongodb kind/feedback Issue for gathering feedback. team/client Issue for team Client. topic: previewFeatures Issue touches on an preview feature flag labels Jul 16, 2021
@hinsxd

This comment has been minimized.

@Lefcott
Copy link

Lefcott commented Nov 30, 2021

Hi! I think it would be great to have a way to model nested fields, since it's something quite common when using MongoDB.

At this moment, I would have to define two models, for example:

model Match {
  id        String     @id @default(dbgenerated()) @map("_id") @db.ObjectId
  movements Movement[]
}

model Movement {
  id          String     @id @default(dbgenerated()) @map("_id") @db.ObjectId
  match       UserMatch? @relation(fields: [matchId], references: [id])
  matchId     String?    @db.ObjectId
  date        DateTime
}

And it would be great to have something like this:

model Match {
  id        String     @id @default(dbgenerated()) @map("_id") @db.ObjectId
  movements [
    {
      date DateTime
    }
  ]
}

Hope this is useful, thanks!

@2color
Copy link
Contributor

2color commented Dec 2, 2021

Hey @Lefcott,

Thanks for sharing your feedback. We have an open issue for embedded documents which would allow you to type nested objects. Feel free to give it a thumbs up and share any thoughts you have on the design proposal.

@jbeckton
Copy link

So is introspections supported or not? The getting started tutorial has you go through the steps of introspecting an existing MongoDB but on the MongoDB connector page is says it's not supported. Is there at least some support for introspection for MongoDB?

@janpio
Copy link
Member

janpio commented Dec 20, 2021

Introspection for MongoDB was added to the mongodb preview feature with 3.2.0: https://github.com/prisma/prisma/releases/tag/3.2.0 Can you point where we have outdated information in our docs - or even send a PR fixing it please?

@janpio
Copy link
Member

janpio commented Jan 29, 2022

prisma/docs#2781 @jbeckton

@Skellord
Copy link

Hi! I have existing DB, which have collections, created by import from TSV files. Now i just trying to connect Prisma and there is the question. Can i provide collection name, when i describing model in schema? Or i need to describe all fields in model, to make query working. For now i describe few fields in model, but existing mongo document have more fields, and Prisma query doesn't work. Maybe i miss something?

@Jolg42
Copy link
Member

Jolg42 commented Mar 21, 2022

@Skellord so here if I understand, you only specified some fields in your model in the Prisma schema, and you are trying to query using the Prisma Client, but it fails?
Which query are you running?
What error do you get?

I can recommend introspecting the collection using db pull, which will create a Prisma schema, see
https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/mongodb/introspection-typescript-mongodb#introspecting-mongodb-with-prisma

@Skellord
Copy link

@Jolg42 thanks for answering. Yes, you got me right, and yes, i miss introspecting step -_-. Now it's working. Thank you again, and sorry for wasting time.

@matthewmueller
Copy link
Contributor Author

MongoDB General Availability shipped in 3.12.0!

If you run into any issues, please open a new issue. Thanks everyone!

@Jolg42 Jolg42 added this to the 3.12.0 milestone Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feedback Issue for gathering feedback. team/client Issue for team Client. topic: mongodb topic: previewFeatures Issue touches on an preview feature flag
Projects
None yet
Development

No branches or pull requests

10 participants