REST API on top of ignite using node express

classic Classic list List threaded Threaded
1 message Options
nithin91 nithin91
Reply | Threaded
Open this post in threaded view

REST API on top of ignite using node express

Hi ,

We are trying to build an Rest API on top of ignite cache using node

Following is the way we are fetching data from ignite.

await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT));
const cache = igniteClient.getCache(CacheNAME);

const querysql=new SqlFieldsQuery("SqL");
const cursor = await cache.query(querysql);
const row =await  cursorProductDetails.getValue();

We are facing the following issues while fetching the data in cursor.

1. cursor._values property is always having only 1024 rows even though the
table as 100k rows.
2. cursor._fieldnames  property  is not displaying the field names as result
of which we have created an
array with list of fields and creating a list of json objects using this
array and  traversing each row of cursor._values using map function.

Please check below for sample code

var dataProductDetails=cursor._values ;

var res_data_prddetails=[];

 var fields=[field1,field2]
                                 var prdobj={};
                                 fields.forEach((k,v)=> prdobj[k]=arr[v]);

Also can you please let me know whether there is a way to directly convert
the sql fields query output to JSON using node express.

Sent from: