Get specific bins in node.js

The AerospikeClient in java has a get method that allows to only request specific bins for a Record.

[...] public final Record get(Policy policy, Key key, String... binNames) [...]

It looks like the Aeroskipe client ‘select’ function in node.js is equivalent.

[...] client.select(key, bins, function ( err, bins, metadata, key) { [...]

Please can you confirm?

Thank you for your help

Hi mlabour,

Yes, they are same, selecting few bins in a record.

Here is the link to documentation.

https://github.com/aerospike/aerospike-client-nodejs/blob/master/docs/client.md#select

Hi gayathri

Thank you for your reply. May I ask a follow up question. Is there a way to batch get items and specified an array of bins to retrieve in node.js?

I believe it is possible in java

[...]public final Record[] get(BatchPolicy policy, Key[] keys, String... binNames) [...]

Thank you

Hi Mlabour,

We are in the process of releasing that API. We are doing internal QA. Should be available within this week. Will update you once we make an official release.

Thanks

Gayathri.K

Awesome. We are looking forward to the new release. Thank you very much for this great library. There are also the following 2 features that we ended up implementing.

  1. ability to nuke a set/ delete all keys in a set.
  2. batch put an array of key values. right now we created a synthetic batchPut that loops through an array and put. We could certainly create a UDF piece of code as well for that. Let me know if u want us to contribute the code that we created for 1 and 2. Cheers -matthieu

Hi Mlabour,

We released version 1.0.38 with the ability to select bins in a batch API call. You can use them and give us your feedback.

Regarding set-delete, there’s an asinfo command to delete the set. That is all the records in the given set is deleted. But note that it’s a lazy deletion. Set is marked as deleted and a thread garbage collects these records in the background. The command for set delete is

asinfo -v "set-config:context=namespace;id=<name space>;set=<set name>;set-delete=true;"

where:

<name space> is the namespace containing the set
<set name> is the name of the set to delete.

The same info command can be used through nodejs API. Here is the example demonstrating info command usage.

Regarding batchPut API, currently we do not support writing in batch to Aerospike server. Will update you as and when we support this in our server.

Thanks

1 Like