lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.35k stars 448 forks source link

[Feature Request]: Support for MongoDB `_id` in Custom Database Adapter #1524

Closed fruneen closed 3 months ago

fruneen commented 3 months ago

Package

lucia

Description

Hey! 👋

I'm currently integrating Lucia with Ship project, which uses MongoDB as its database with our custom database extension for MongoDB driver - node-mongo.

I noticed that Lucia's database adapter interface expects an id field without an underscore, but MongoDB conventionally uses _id for its primary key identifier. This discrepancy makes it challenging to seamlessly integrate Lucia with node-mongo.

I know that the built-in adapter uses transformations between 'id' and '_id', but is there any way to use '_id' with lucia right now?

P.S. I really keen on your library and I'm looking forward to using it in our commercial projects!

pilcrowOnPaper commented 3 months ago

I'm not sure how that would work since it'd either Lucia sends both id and _id or somehow send either depending on the adapter. Either way, that'd make the API more complicated than it needs to be just to make supporting one use case a tiny bit easier.