basho / riak-nodejs-client

The Riak client for Node.js.
Apache License 2.0
72 stars 29 forks source link

How to set user Meta [JIRA: CLIENTS-390] #52

Closed awenger closed 9 years ago

awenger commented 9 years ago

ValidationError: "userMeta" is not allowed:

client.storeValue({
    bucketType: 'test',
    bucket: 'bucket',
    value: {
        abc: 1,
        def: 'hello world'
    },
    userMeta: [{
        key: 'a',
        value: 'b'
    }]
}, function(err, result) {
    console.log(err, result);
});
lukebakken commented 9 years ago

Hello,

Please see the following documentation:

http://basho.github.io/riak-nodejs-client/classes/StoreValue.html http://basho.github.io/riak-nodejs-client/classes/RiakObject.html http://basho.github.io/riak-nodejs-client/files/lib_commands_kv_riakobject.js.html#l145

To set user metadata, you must use a RiakObject for your value. Please see the following example code that I have created:

https://github.com/basho/riak-nodejs-client-examples/blob/master/github/issue-52/example.js

It requires the following bucket type:

$ riak-admin bucket-type create github
$ riak-admin bucket-type activate github