-
Notifications
You must be signed in to change notification settings - Fork 20
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
Malformed ObjectID #95
Comments
Hi @Sunnuld - thanks for reporting this limitation. I think when the library was created, MongoDB was not yet supported by Prisma. The library has been used with Postgres and SQL Lite - but I'm just now realizing I don't know if anyone is using it with MongoDB yet.
I'm pretty limited time-wise right now, and may not get a chance to explore this properly. If you feel at all like trying this out though, and perhaps posting a PR if it works, I'll bet there are others who would appreciate the result. |
There's actually no such restriction, as long as you You get a different issue when you try to use the id field as _id (can't quite remember what it is, but it's described in #83)
|
Thanks for the replies! @SunburntRock89 - I had tried literally everything, except maybe the concept of saving the _id in a separate field to the id that this package passes 🙈 This was as far as got before I edited the source files (untested) to allow this
|
@kleydon - No, that was as far as I got. Using that layout still produces the malformed ObjectId Error. I brute-forced a fix by removing:
From the data object @line 391, prisma-session-store.ts, I haven't had time to test this, beyond successfully writing/reading sessions from the database |
@Sunnuld Ok - good to know. |
@SunburntRock89 - Do you think this can be closed, now that PR #96 is merged, or are there other details that need to be thought through? |
@kleydon In my (limted) testing you don't need a specific object ID field anymore. In fact I think I ended up encountering another, bigger issue because of using the workaround whilst testing this change. Fairly sure this is resolved. |
👍 |
As far as I can tell I cannot get this to work when using MongoDB as the database.
Mongo expects its '_id' parameter to be of type ObjectId (bson), but I have found no way of making dbRecordIdFunction return a valid ObjectId
Why does this package rely on inserting the id field into the database, instead of allowing Prisma/Mongo to generate its own, via @default()?
The text was updated successfully, but these errors were encountered: