I need to find a record by RegExp pattern of one of its bins. But to be honest i am getting all existing results in set instead of matched. Reproducable result is here:
const Aerospike = require('aerospike');
const client = Aerospike.client({
hosts: AEROSPIKE_HOST
});
async function connect () {
await client.connect();
const key1 = new Aerospike.Key('test', 'demo', 'key1');
const key2 = new Aerospike.Key('test', 'demo', 'key2');
const key3 = new Aerospike.Key('test', 'demo', 'key3');
const record1 = {
key: 'key1',
tags: ['tag1'],
data: 'wow'
};
const record2 = {
key: 'key2',
tags: ['tag2'],
data: 'wow2'
};
const record3 = {
key: 'key3',
tags: ['tag1, tag2'],
data: 'wow3'
};
await client.put(key1, record1);
await client.put(key2, record2);
await client.put(key3, record3);
const expr = Aerospike.exp.binStr('data');
const exp = Aerospike.exp.cmpRegex(0, "^.*aaaa.*", expr)
const query = client.query('test', 'demo', exp)
const result = await query.results();
console.log(result)
}
connect()
Expected result: received empty result Actual result: received array of 3 results - all of the keys
I am not sure that my code is correct, by the way. By it is similar with the code that i get from the internet or other clients (c# and java), did not find any workable example for Nodejs. I will be thankful for any comments on this issue