osin-mongo-storage icon indicating copy to clipboard operation
osin-mongo-storage copied to clipboard

UpserId does not work for me

Open gdiazlo opened this issue 10 years ago • 2 comments

Hello

The mongo storage uses this to save accesses, authorizations and clients:

UpsertId(data.Code, data)

But it does not work for me. (mongodb 2.4.9) It does not save data.Code as the id but an ObjectID generated by mongodb.

Does it work for you? what i'm missing with this?

thanks

gdiazlo avatar Jul 23 '14 07:07 gdiazlo

Changin the UpserId part in SaveAccess with:

udata:= bson.M{"$set": data}
_, err := accesses.UpsertId(data.AccessToken, udata)

Works, but then, when recovering the data in LoadAccess, I get errors:

reflect.Set: value of type bson.M is not assignable to type osin.Client

gdiazlo avatar Jul 23 '14 14:07 gdiazlo

Nevermind, I guess this is because I'm using the latest osin patch with the breaking changes...where Client is an interface.

gdiazlo avatar Jul 23 '14 14:07 gdiazlo