0

I am using ydn-db as the plugin

I have defined indexes (secondary key) and I want to check if I have any data matching for that index.

suppose I have column3 as the index and I have the value "1001" Is there a way I can get a count/data or something if column3 has the value 1001 in it?

Swapnil Mhaske
  • 365
  • 7
  • 21
  • create a loop and iterate your data and check it; jquery/javascript doesn't contains a function for array/object called 'contains'(from what I remember) – HellBaby Dec 19 '13 at 12:48

1 Answers1

1

It should be as simple as:

var kr = ydn.db.KeyRange.only(1001);
db.count('store name', 'index name', kr)

Or using newer syntax:

db.from('store name').where('index name', '=', 1001).count().done(...
Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • Thanks Kyaw Tun it worked for me.Here is the link for api ref count [link](http://dev.yathit.com/api-reference/ydn-db/query.html) – Swapnil Mhaske Dec 20 '13 at 05:30