-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Querying #10
Comments
This is definitely on our roadmap to add. Thanks. |
+1, and also scan api like Java. without a query mechanism, the NodeJS client is incomplete/not production ready, you'd better mark it as "alpha" or "preview release". |
It's not that simple, since node.js is single threaded. Personally what I ended up doing for a project was make a C process that I spawn in my node.js module and converse back and forth via stdin/out and it performs well (300m results in batches of 1000 results each, performs for us ~30k results a second). |
ic. so a technical challenge is NodeJS client uses C client, and it cannot easily sprawn new thread/process so operation that load a let of records will block the while NodeJS app. I think there are many uses of using NodeJS client that may tolerate the limitation, e.g.
the dev may consider to implement the query api, and give a strong warning on the limitation. And then address the process spawning issue and Scan API later. |
+1 how do i do set scans? |
A bunch of design discussions here at Aerospike Central, we think we've found the right implementation path to get various queries in soon. Thanks for the comment about reasonable limitations. |
i guess it is possible to use the java driver in nodejs simple working code: //index.js
//npm init
//npm install java
//download latest jar with dependencies http://www.aerospike.com/download/client/java/
//help on java: https://github.com/joeferner/node-java
if(require.main === module) { var repl = require("repl");repl.start({ useGlobal:true, useColors:true, }); }
//some variables are without var to put them in global so it will be visible in repl
var java = require("java");
java.classpath.push("aerospike-client-3.0.28-jar-with-dependencies.jar");
var AerospikeClient = java.import('com.aerospike.client.AerospikeClient');
//var ClientPolicy = java.import('com.aerospike.client.policy.ClientPolicy');
//var WritePolicy = java.import('com.aerospike.client.policy.WritePolicy');
Bin = java.import('com.aerospike.client.Bin');//global
Key = java.import('com.aerospike.client.Key');//global
Record = java.import('com.aerospike.client.Record');//global
newBinsArray = function(arr){return java.newArray("com.aerospike.client.Bin", arr)}
/*
policy = new ClientPolicy();
policy.user = params.user;
policy.password = params.password;
policy.failIfNotConnected = true;
var ArrayList = java.import('java.util.ArrayList');
var list = new ArrayList();
list.addSync('item1');
java.newInstanceSync("java.lang.Long", 5);
var client = new AerospikeClient(policy, "10.0.2.15", "3000");
*/
//writePolicy =new WritePolicy();//global
client = new AerospikeClient("127.0.0.1", 3000);//global
var key = new Key("test", "demo", "putgetkey");
var bin1 = new Bin("bin1", "value1");
var bin2 = new Bin("bin2", "value2");
var binsArray = java.newArray("com.aerospike.client.Bin", [bin1, bin2]);
// Write a record
//client.putSync(writePolicy, key, binsArray);
client.putSync(null, key, binsArray);
// Read a record
var record = client.getSync(null, key);
if (record == null) {
console.log('record not found');
}
else
{
var received1 = record.getValueSync(bin1.name);
var received2 = record.getValueSync(bin2.name);
console.info("Bin matched: namespace=%s set=%s key=%s bina=%s valuea=%s binb=%s valueb=%s generation=%d expiration=%d",
key.namespace, key.setName, key.userKey, bin1.name, received1, bin2.name, received2, record.generation, record.expiration);
}
//client.closeSync();
//probably any operation that is over network or disk should be async here is an async version,
//just append callback to end with err and result as the return value.
//var client = new AerospikeClient("127.0.0.1", 3000);
var key = new Key("test", "demo", "putgetkey");
var bin1 = new Bin("bin1", "value11");
var bin2 = new Bin("bin2", "value22");
// Write a record
//client.putSync(writePolicy, key, binsArray);
client.put(null, key, newBinsArray([bin1, bin2]), function(err,result){
// Read a record
client.get(null, key,function(err,record){
if (record == null) {
console.log('record not found');
}
else
{
var received1 = record.getValueSync(bin1.name);
var received2 = record.getValueSync(bin2.name);
console.info("Bin matched: namespace=%s set=%s key=%s bina=%s valuea=%s binb=%s valueb=%s generation=%d expiration=%d",
key.namespace, key.setName, key.userKey, bin1.name, received1, bin2.name, received2, record.generation, record.expiration);
}
//client.closeSync();
});
}); |
Will there be any updates on the node aerospike client soon? I checked that last updates on this repository is about 3~4 months ago. And I want to know that query and streaming UDF feature will be included. |
Hi, |
I need to be able to query for records similar to how you can in the java client. Can this please be added? Thanks
The text was updated successfully, but these errors were encountered: