Kozlov
February 2, 2016, 7:47am
1
Hello Brett.
Help to understand the anomaly.
Executing the following code:
$res = $cbBucket->get($cbGet);
echo "\r\n<hr><b>cbGet res</b><br>";
var_dump($res);
data type of "value"
On Monday object(stdClass) :
cbGet res
object(CouchbaseMetaDoc)#16 (4) { ["error"]=> NULL ["value"]=> object(stdClass)#8 (5) { ["docId"]=> string(24) "062e186f1b210e49d17a914a" ["createdAt"]=> int(1454140186) ["updatedAt"]=> int(1454266897) ["userEmail"]=> string(19) "mne@sergeykozlov.ru" ["userPassword"]=> string(8) "Password" } ["flags"]=> int(33554438) ["cas"]=> resource(7) of type (CouchbaseCAS) }
On Tuesday string :
cbGet res
object(CouchbaseMetaDoc)#12 (4) {
[“error”]=>
NULL
[“value”]=>
string(142) “{“docId”:“eded5a6cc3ec348e767084d2”,“createdAt”:1454390234,“updatedAt”:1454393253,“userEmail”:“mne@sergeykozlov.ru”,“userPassword”:“Password”}”
[“flags”]=>
int(0)
[“cas”]=>
resource(2) of type (CouchbaseCAS)
}
Why is change the data type?
jarro
February 6, 2016, 9:10pm
2
Only time I’ve seen this, is if you edit a doc from the web admin it will also change the flag value.
brett19
February 10, 2016, 12:41am
3
Hey @Kozlov ,
As @jarro has mentioned. If you modify the document in the Web UI, this can cause the flags meta-data for the document to be modified and this will cause the client to see the value as being a string rather than JSON.
Cheers, Brett
Kozlov
February 10, 2016, 7:27am
5
Hello.
Thank you for your responses.
Correctly I understood:
Change the data type spit-only web interface ?:
http://server.com:8091/index.html#sec=documents&viewsBucket=user&documentsPageNumber=0&docId=1964260788%40hcents.net
Thank you.
jakub.m
February 13, 2017, 11:10am
6
So is there a way to prevent Web UI from modifying metadata? Or at least is there a way to force CB to return data in a given format (JSON or object)…
avsej
February 14, 2017, 10:32am
7
if you are talking about PHP clients, it does handle case with zero flags as JSON since 2.2.3
All our sample buckets do not set common flags, so the users have to to
deserialize the body from string at first time, which is not obvious.
The solution is to try to deserialize legacy values as JSON, and if it
fails, return contents as a string.
Change-Id: I29ed4a230a24be9af62b76b7d57f01d495067bc2
Reviewed-on: http://review.couchbase.org/62414
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
changed 2 files
with 8 additions
and 2 deletions .
But the server still hasn’t fixed this issue https://issues.couchbase.com/browse/MB-21541