How to get single record from table.
Can anyone help me, I'm trying to get single row (record) from table but get_table_rows api return all the record. how can I get single record based on some condition match from table.
add -l 1 to your request.
-l will limit the record but my requirement is to get a single record from table based on condition match. for example - struct = { rows: [{'age': 20, 'name': 'rahul''}, {'age': 18, 'name': 'prachi'}, {'age': 22, 'name': 'ram'}] }; from this table how can i get only row number two. Please elaborate.
You can only use primary or secondary index to query the table. You can index your search criteria if possible.
I tried with secondary index but it will sort the data and return full result but i want to get only one record which will match the criteria. How can I do that ?
If you can convert your criteria to be something sortable and fit into some of the secondary key, then you can still use get_table_rows with limit 1. Otherwise, there's no easy solution to your problem.