[MB-7069] Fix UI to support Non-JSON values ( was: Non-JSON values which are not integers show up as base-64 encoded when viewed through the UI document viewer) Created: 31/Oct/12  Updated: 12/Aug/13

Status: Reopened
Project: Couchbase Server
Component/s: ns_server
Affects Version/s: 2.0
Fix Version/s: feature-backlog
Security Level: Public

Type: Improvement Priority: Major
Reporter: Perry Krug Assignee: Anil Kumar
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File StringAsNonJson.png     PNG File StringNumbersAsValidJson.png    

-Set a key with some non-JSON value
-View that key through the document viewer in the UI
-See that the value does not match what was just set

I presume this is because we are compressing the data at the disk level and then reading that binary attachment back when viewing through the UI...but it's quite confusing for the user to not be able to see what they thought was simple string data.

Does this at all affect views of non-JSON (i.e., increment counters)? Even in the random doc preview, this data does not come across correctly...

Comment by Chiyoung Seo [ 01/Nov/12 ]

Please assign this bug to the view or UI team. ep-engine has nothing to do with view and its UI.
Comment by Farshid Ghods (Inactive) [ 01/Nov/12 ]

can you please specify whether the document was an ascii or a binary data ?
Comment by Perry Krug [ 01/Nov/12 ]
Ascii. I tried both a few characters in string and a single integer value (as if it were an increment counter value).

This came up from a customer who created a CSV list and wanted to view it through the UI as well as design a view around it.

I'm fairly certain the problem is that this mechanism for viewing documents is coming directly from the on-disk datastore (as opposed to through memcached) and therefore it is compressed binary and not exactly what the application put in.

Let me know if you need more specific reproduction details.
Comment by Deepkaran Salooja [ 01/Nov/12 ]
Anything which doesn't parse as valid json are encoded as base64 and stored as an attachment. In the UI for document viewer these get displayed as binary.
There was a recent bug fix for the increment counter values. So string integers will show up fine as they now parse as valid JSONs(screenshot attached-StringNumbersAsValidJson). Please see MB-6961 for detailed discussion.
For normal strings, these will get displayed as binary(screenshot-StringAsNonJson).
Comment by Farshid Ghods (Inactive) [ 01/Nov/12 ]
resolving this as won't fix since this is an expected behavior as mentioned in the last comment

the fix for this would be to reverse the base64 coding ?
Comment by Farshid Ghods (Inactive) [ 01/Nov/12 ]
for 2.0 i marked this to be documented since our documented editing section is not meant for non-json values ( e.g http://www.couchbase.com/issues/browse/MB-7031)
Comment by Perry Krug [ 01/Nov/12 ]
Sorry if it should be obvious...but this is already fixed in a later release and so just have to document for the beta? Or is it planned for this never to be supported?

Thanks Farshid
Comment by Farshid Ghods (Inactive) [ 01/Nov/12 ]
>>.but this is already fixed in a later release
viewing non-json values on document editing page is not supported or expected behavior.
however as Deep mentioned a corner case is fixed in MB-6961

once 7031 is merged ( before 2.0 GA ) user will see a better error message when document is non-json

so for 2.0 GA we need to document that this behavior is not supported and expected.

Comment by Perry Krug [ 01/Nov/12 ]
Okay, I might need to question that a little bit...how is a user supposed to write a view around a non-JSON (i.e. an incremement counter or CSV) if they can't see it in the document viewer? Writing such views is supposed to be supported right? Seems like this would have to be as well?

Obviously document it for whenever we can't, but I think Dipti needs to decide how to address it.
Comment by MC Brown (Inactive) [ 05/Nov/12 ]
Note has been added to the corresponding section of the docs,and to the release notes.
Comment by Perry Krug [ 05/Nov/12 ]
Reopening as it's still not clear whether this is something we want to support or not...and I argue that we should.
Comment by Dipti Borkar [ 06/Nov/12 ]
The UI does not handle BLOB data very well. Data access using the APIs for BLOBs is completely supported and works well.
Comment by kzeller [ 27/Mar/13 ]
Removing docs tag, additional server work required. Reassign when ready to document post-resolution.
Comment by Aleksey Kondratenko [ 12/Aug/13 ]
As discussed I'm not seeing any sensible way to support arbitrary values and don't think it's worth trying to.
Comment by Perry Krug [ 12/Aug/13 ]
This does come up on a fairly regular basis, especially since we do advocate using strings and integers within our documents (as non-JSON) and yet we don't display them properly in the UI. Could we just do a base64 decode on the value and display whatever returns from that?
Comment by Aleksey Kondratenko [ 12/Aug/13 ]
If you want specifically to support strings and integers then please ask specifically for that. And work with Anil on spec.
Generated at Thu Nov 27 12:46:37 CST 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.