This project has moved and is read-only. For the latest updates, please go here.

is it possible to retrieve and filter the array of an array?

Oct 12, 2012 at 10:52 PM
Edited Oct 12, 2012 at 10:56 PM

I have a record in indexedDB:




is it possible to retrieve and filter the array of an array using linq2indexedDB?

in my example, i want to retrieve only the contact having -> {"id":2,"name":"Emmy"}

Oct 14, 2012 at 12:20 PM

Try the following:

db.linq.from("objectstore").where("").equals(2).select(["", ""]);

Oct 14, 2012 at 6:49 PM

it does not work.. the output is: []

and when i tried without the where condition :

db.linq.from("group").select(["", ""]).then(function(data){

i hv got this : [{"contact":{}}]

Here is the test that i tried:

//Structure of contact
function ContactVO(){ =0;;

//Structure of group
function GroupVO(){ = 0; new Array();

//Create contact 1
var c1 = new ContactVO();;'Christopher';

//Create contact 2
var c2 = new ContactVO();;'Emmy';

//Create contact 3
var c3 = new ContactVO();;'Annick';

var g1 = new GroupVO();;

var contacts = new Array();
contacts.push(c3); = contacts;  //a group can contain many contacts, for this example, there are three contacts

 var db = $.linq2indexedDB("group", null, true);

Any idea?

Oct 17, 2012 at 8:07 AM

I don't know if it was a typo or not, but when you insert you insert d1 which isn't defined.

Nov 2, 2012 at 9:59 PM
Edited Nov 2, 2012 at 10:07 PM

Sorry, it s not d1, but g1

The solution that i have found is to use  "filter" for the array contact


data[0].contact.filter(function (e) {


Anyway, thanks for your help