I writing a node.js application using rethinkdb as a backend.
To retrieve a json value you can use:
r.table('users').get(1).run()
That method call will return the full json document, there is however a method that allows you to specify the attributes to retrieve e.g:
r.table('users').get(1).pick('firstName', 'lastName').run()
I want to make use of this functionality and I have the attributes I want to 'pick' stored in an array. I can't seem to figure out a way to convert this array to a parameter list for the .pick method.
Please advice.
Just use the native apply method to directly pass the arguments array:
r.table('users').get(1).pick.apply(this,yourArray).run()