BA
Better Auth•18h ago
Rob

object as a user additional field

Hello everyone, I'm coding with svelte, sveltekit and mongoDB and trying to change my app log/sign with better-auth My issue is : I would like to add an object as additional field of a new user. However the type object doesnt exist yet so I can't do that. I tried from the database hook user after : js async after(user) { await usersCollection.updateOne( {_id: new ObjectId(user.id)}, {$set : { myobj1:{...}, myobj2: {...} }} ); In this case, fields are well registered in the DB, but are not available from the client side. I tried with the hook before(), but doesn't work if user.additional field is not fulfill.. Someone already had this issue ? If yes how have you solve it ? May be could be my "logic", I mean if it is not a correct way to add object field to the user. Thank for reading and helping 🙂
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?