The sample that I got from this couchbase blog, seems to suggest that I need to loop the search in the nosql which in my opinion is inefficient and dangerous when it comes to searching millions of document. Did I misundertand it? Any suggestion?

So how do I do it in couchbase nosql language the right way?

query example :

```
select * from users where loginname='xxx' and passwd='yyy'

```

Nosql/couchbase example :

```
function (doc, meta) {
  if (doc.ingredients) {
    for (i=0; i < doc.user.length; i++)                                                              {                                                                                                         if (doc.user[i].loginname != null)
      {
        emit([doc.user[i].loginname , doc.loginname], null);  
      }
    }  
  }
}

```