Description
I’m attempting to insert a buffer of binary data, and it gets mangled by the couchbase driver upon insert. The Admin console shows the data as mangled, and fetching the item again from the bucket using the API shows it as well.
The following code reproduces the test case on Node v12.15.0 and Ubuntu, using Couchbase 3.0.3. This is a regression. I’ve tested on 2.6.12 and the data is properly preserved.
var couchbase = require('couchbase');
|
var assert = require("assert");
|
var mainCluster = new couchbase.Cluster('', { username: '', password: '' })
|
var mainBucket = mainCluster.bucket('');
|
var mainColl = mainBucket.defaultCollection();
|
let valueToInsert = "092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d774d604487b654d829769af3007a4c0a1092bc691fb824300a6871ceddf7090d774d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a1"
|
async function main() {
|
await mainColl.upsert("test", Buffer.from(valueToInsert, 'hex'));
|
let result = await mainColl.get("test")
|
assert(valueToInsert == result.value.toString('hex'))
|
}
|
main()
|