Hi All,
I'm struggeling with an issue for a couple of weeks now and I can't figure it out.
On the application front-end, I'm trying to generate an API token so that my users can have access to my application data from another app (salesforce for instance).
When hitting generate, it creates a API key and stores it at 2 places: at the account/project level for a quick access and in the authentication collection.
The token is correctly updated at account level, but is not inserted in the authentication database ANYMORE! It worked 4 times and now we can't store a token in this database anymore. Note that in the same collection, I'm storing cookie and httpheader authenticators which is working fine.
Of course it works properly on my local machine and on the staging (release candidate) environment - note that the mongodb version of these 2 environments is 3.0.8 while the prod environment is 2.6
I'm using scala with reactivemongo
I've tried many different options:
1) update with upsert = true - (as for cookie and httpHeader authenticators)
2) inserting scala object with a BSON serializer
3) inserting a raw BSONDocument
4) inserting a Json Object
Moreover, I get the confirmation that the insert succeeded.
Here is a piece of my code (version 4 with Json Object) - works fine on localhost and RC:
val authenticator = Json.obj("id" -> id, "user" -> user, "expirationDate" -> exp.getMillis, "lastUsed" -> last.getMillis, "creationDate" -> create.getMillis)
Logger.debug("Generated authenticator for API token: " + authenticator)
collection.insert(authenticator).onComplete {
case Failure(e) =>
Logger.error("API TOKEN NOT SAVED "+e)
throw e
case Success(writeResult) =>
Logger.info(s"successfully inserted API token with result: $writeResult")
}
I get the logger:
> Generated authenticator for API token
AND
> [info] application - successfully inserted API token with result: reactivemongo.api.commands.DefaultWriteResult: DatabaseException['<none>']
But nothing has been inserted in the DB - What should I do?
Is that the right way to insert and verify the insert in the collection?
I'm hosting my DB on mLab, but they haven't been able to help me so far...
Thanks a lot for your help,
Olivier
Which RM version? Do you have debuged the write result, which seems to hold a DatabaseException ?
--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/SbEC3g1XXnk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemong...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.