Skip to content
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

Unable to find record by regexp pattern #624

Open
Ivan-Ratkin opened this issue Jun 27, 2024 · 0 comments
Open

Unable to find record by regexp pattern #624

Ivan-Ratkin opened this issue Jun 27, 2024 · 0 comments

Comments

@Ivan-Ratkin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant