Skip to content

Instantly share code, notes, and snippets.

@capslocky
Last active January 30, 2024 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save capslocky/aad2e8e617a9225639fbaa3a92a8ba1c to your computer and use it in GitHub Desktop.
Save capslocky/aad2e8e617a9225639fbaa3a92a8ba1c to your computer and use it in GitHub Desktop.
Couchbase metadata Common Flags
flags value (decimal) flags value (binary) bits #[5,6,7,8] decimal type note
16777216 00000001000000000000000000000000 0001 1 Private couchbase docs example
33554432 00000010000000000000000000000000 0010 2 JSON couchbase docs example
33554438 00000010000000000000000000000110 0010 2 JSON default from http rest api
50331648 00000011000000000000000000000000 0011 3 Raw Binary couchbase docs example
67108864 00000100000000000000000000000000 0100 4 Non-JSON String couchbase docs example
67108868 00000100000000000000000000000100 0100 4 Non-JSON String extra 'JSON.stringify(entry)' with nodejs official sdk
curl --request POST 'http://host:8091/pools/default/buckets/my-bucket/docs/123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic XXX' \
--data-urlencode 'value={ "name": "John"}' \
--data-urlencode 'flags=67108864'
// how to convert values in browser console
0x02 << 24
// 33554432
(33554432).toString(2).padStart(32, '0')
// "00000010000000000000000000000000"
"00000010000000000000000000000000".substring(4, 8)
// "0010"
parseInt("0010", 2)
// 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment