-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couchbase.Extensions.Session - can data be stored as raw JSON? #60
Comments
This appears to be the commit where it was changed from storing object to storing bytes: 8596da3#diff-f335e5d1377d3fa2cefb1971286defd6 This was part of a larger commit called "upgrade to core 2.0", so it looks like this might have been required by asp.net. I'm going to investigate further to see if it's possible to go back and/or have both options (byte array and raw json) |
I took a hack at this, and I just don't see a way to make this work with the ISession interface the way it is. Basically what I did was try to switch But where it falls apart is SessionTests. The tests fail because GetString, GetInt32, SetString, and SetInt32 are all used, and I just don't see any way to differentiate between them. ASP.NET expects them to be stored as byte values. If I try to accommodate that (mainly in This is kinda lame, because I think the power in using Couchbase for a session store comes with being able to query/index it with N1QL/Analytics/MR/etc. Having the values encoded as base64 means that I have to choose between building my own session store or foregoing that Couchbase power. |
There's actually a kinda cool workaround for this. Not ideal, but pretty good. Say I have a session document like so:
Not terribly useful for N1QL querying. BUT, there's a
That returns:
So, it's a little extra work to do the decoding (and corresponding indexing), but it does work. It would still be much easier (for N1QL) if the data stored was not encoded in the first place. |
When using the
SetObject
extension, data is stored in Couchbase like so:Which appears to be an encoded byte array.
But it seems like this is a change in behavior since 1.0.0-beta2, which would store as literal JSON (see blog post https://blog.couchbase.com/distributed-session-aspnet-couchbase/):
It's not the end of the world if it must be the former, but it does limit analysis on sessions that can be done with N1QL/SQL++/Analytics/FTS. Is it possible there was a change (in the extension or in ASP.NET Core) that caused this? Is it possible to switch it back to storing JSON (or at least to give the option of storing in JSON)?
The text was updated successfully, but these errors were encountered: