strongloop / loopback-component-oauth2

oAuth 2.0 server for LoopBack
http://www.strongloop.com
Other
62 stars 63 forks source link

Duplicate error creating second OAuthToken data in MongoDB #7

Closed feelinc closed 8 years ago

feelinc commented 9 years ago

Hi,

I'm having following error :

insertDocument :: caused by :: 11000 E11000 duplicate key error index: theDatabase.OAuthToken.$id_1 dup key: { : null }

I already check that the new generated token => "id" is not having same id as already exist in the MongoDB collection, but still the error occur.

I'm trying to run the OAuthToken.create() function manually with "id" that does not exist, but still the error occur.

I'm not modifying the model.

What possibly wrong?

Thanks in advance.

raymondfeng commented 9 years ago

It complains the duplicate key of null. Can you check if the id is set to null?

feelinc commented 9 years ago

I saw the default schema is set the "id" index as unique. So I temporarily solved by setting the "id" as not unique in MongoDB.

Then I can create a lot of OAuthToken without duplicate error.

Thanks.

loay commented 8 years ago

@feelinc is this issue resolved or still persisting? Thanks.

loay commented 8 years ago

Hello, I am closing due to inactivity. If you are still running into problems, feel free to leave a comment and I will reopen the issue. Thanks.