<commit_before>'use strict';

var config = require('../../config');
var async = require('async');
var logger = require('winston');
var Riak = require('basho-riak-client');

function GitHubIssue52(done) {

    var client = config.createClient();

    client.fetchValue({
            notFoundOk: true,
            bucketType: 'github', bucket: 'issues', key: '52'
        }, function (err, rslt) {
            logger.debug("fetch err: %s", JSON.stringify(err));
            logger.debug("fetch rslt: %s", JSON.stringify(rslt));

            var value = {
                abc: 1,
                def: 'hello world'
            };

            var userMeta = [
                {
                    key: 'a',
                    value: 'b'
                },
                {
                    key: 'c',
                    value: 'd'
                }
            ];

            var riakObj;
            if (rslt.isNotFound) {
                var riakObj = new Riak.Commands.KV.RiakObject();
                riakObj.setContentType('application/json');
                riakObj.setValue(value);
                riakObj.setUserMeta(userMeta);
            } else {
                riakObj = rslt.values.shift();
                var updatedValue = {
                    abc: 1,
                    def: 'hello world updated at: ' + Date.now()
                };
                riakObj.setValue(updatedValue);
            }

            client.storeValue({
                bucketType: 'github', bucket: 'issues', key: '52',
                returnBody: true, value: riakObj
            }, function (err, rslt) {
                logger.debug("store err: %s", JSON.stringify(err));
                logger.debug("store rslt: %s", JSON.stringify(rslt));
                done();
            });
        }
    );
}

module.exports = GitHubIssue52;<commit_msg>no need to specify bucketType, bucket or key when using RiakObject<commit_after>'use strict';

var config = require('../../config');
var async = require('async');
var logger = require('winston');
var Riak = require('basho-riak-client');

function GitHubIssue52(done) {

    var client = config.createClient();

    client.fetchValue({
            notFoundOk: true,
            bucketType: 'github', bucket: 'issues', key: '52'
        }, function (err, rslt) {
            logger.debug("fetch err: %s", JSON.stringify(err));
            logger.debug("fetch rslt: %s", JSON.stringify(rslt));

            var value = {
                abc: 1,
                def: 'hello world'
            };

            var userMeta = [
                {
                    key: 'a',
                    value: 'b'
                },
                {
                    key: 'c',
                    value: 'd'
                }
            ];

            var riakObj;
            if (rslt.isNotFound) {
                var riakObj = new Riak.Commands.KV.RiakObject();
                riakObj.setBucketType('github')
                riakObj.setBucket('issues')
                riakObj.setKey('52')
                riakObj.setContentType('application/json');
                riakObj.setValue(value);
                riakObj.setUserMeta(userMeta);
            } else {
                riakObj = rslt.values.shift();
                var updatedValue = {
                    abc: 1,
                    def: 'hello world updated at: ' + Date.now()
                };
                riakObj.setValue(updatedValue);
            }

            client.storeValue({ returnBody: true, value: riakObj }, function (err, rslt) {
                logger.debug("store err: %s", JSON.stringify(err));
                logger.debug("store rslt: %s", JSON.stringify(rslt));
                done();
            });
        }
    );
}

module.exports = GitHubIssue52;
{'fraction_non_alphanumeric': 0.12741210679355008, 'fraction_numerical': 0.005286809410520751, 'mean_word_length': 1.303104077906269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3680983', 'n_tokens_mistral': 1093, 'n_tokens_neox': 999, 'n_words': 218}