bucket.insert('xiaoming', {"age":18, "sex": "boy"}, function(err, result) {
if (err) throw err;
console.log(result);
});
bucket.upsert('xiaoming', {"age":18, "sex": "boy", "country": "china"}, function(err, result) {
if (err) throw err;
console.log(result);
});
bucket.replace('xiaoming', {"age":18, "sex": "boy", "country": "china", "language": "chinese"}, function(err, result) {
if (err) throw err;
console.log(result);
});
bucket.get('xiaoming', function(err, result) {
if (err) throw err;
console.log(result.value);
});js
{ age: 18, sex: 'boy', country: 'china', language: 'chinese' }
bucket.insert('revin', {"age":28, "sex": "boy", "country": "china", "language": "chinese"}, function(err, result) {
if (err) throw err;
//console.log(result);
});
bucket.getMulti(['xiaoming',"revin"], function(err, result) {
if (err) throw err;
console.log(result);
});
{ xiaoming:
{ cas: CouchbaseCas<1533176100324966400>,
value: { age: 18, sex: 'boy', country: 'china', language: 'chinese' } },
revin:
{ cas: CouchbaseCas<1533176505367986176>,
value: { age: 28, sex: 'boy', country: 'china', language: 'chinese' } } }
bucket.remove('revin', function(err, result) {
if (err) throw err;
console.log(result);
});