json - Restangular - custom search - search within an array -


lets assume have mongodb items collection looking (mongolab):

{     "_id": {         "$oid": "531d8dd2e4b0373ae7e8f505"     },      "tags": [         "node",         "json"     ],     "anotherfield": "datahere" } {     "_id": {         "$oid": "531d8dd2e4b0373ae7e8f505"     },      "tags": [         "ajax",         "json"     ],     "anotherfield": "datahere"   } 

i items node within tags array. i've tried below, no success - it returning items - no search performed?

plunker demo : http://plnkr.co/edit/byj09togyctfkhhbxpio?p=preview

// $route.current.params.id = "node" - should give me 1 record tag restangular.all("items").customget("", { "tags": $route.current.params.id }); 

full example, return same record both cases:

    var = db.all('items');      //     all.getlist().then(function(data) {         $scope.all = data;         console.log(data);     });      // search record "tags" has got "node"     all.customget('', { "tags": "node"}).then(function(data) {         $scope.search = data;         console.log(data);     }); 

any suggestion appreciated.

according mongolab rest api documentation have pass query object q parameter. in case q={"tags":"node"}.

using restangular this:

restangular.all("items").customget('', { q: {"tags": "node"}})


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -