Like in previous section, taking the same document, now let's say we wish to index city as well so that we could search people using city.

To do this we will create the nested index like this

tbl->addIndex("address.city", 40, true);

now we can search using the scan_doc again for both name and city

Scan the table where name is sachin and city is bangalore

const char *query = {
    "query":[
       {
          "key":"name",
          "cmp_op":4,
          "val":"sachin"
       },
       {
          "joinop":0
       },
       {
          "key":"address.city",
          "cmp_op":4,
          "val":"Bangalore"
       }
    ]
 };
resultset *rs = NULL; scan_filter sf;
while(true) {
  rs = tbl->scan_doc(rs, NULL, NULL, query, &sf);
  if(!rs) break; while(rs->hasNext()) { 
    // keys and vals 
    rs->moveNext(); 
   } 
}