nathanaschbacher / nodiak

Nodiak is a Node.js client for the Riak Distributed Database
MIT License
43 stars 16 forks source link

Mistake in Bucket.objects.save example? #16

Closed dtonys closed 11 years ago

dtonys commented 11 years ago

In the following example, I think the things_to_save array should be the first argument of the save function.

var things_to_save = [];

for(var i = 0; i < 5; i++) {
    var robj = riak.bucket('users').objects.new('me'+i, { about_me: "I write software." });
    robj.addMeta('extra_info', 'data goes up in here');
    robj.addToIndex('numbers_i_like', [20, 3, 6]);
    things_to_save.push(robj);
}

riak.bucket('users').objects.save(objs, function(errs, objs) {
    console.log(objs);
    console.warn(errs);
});

The save function should look like this, right?

riak.bucket('users').objects.save(things_to_save, function(errs, objs) {
    console.log(objs);
    console.warn(errs);
});
nathanaschbacher commented 11 years ago

Right you are! Thanks for catching that. I'll fix it tonight.