How can i filter multiple fields with OR in Backand?

蓝咒 提交于 2019-12-08 04:50:19

问题


i am passing filter value but its always matches both field where i need optional matches for this

[ { "fieldName": "Firstname", "operator": "equals", "value": "Megh" }, { "fieldName": "Lastname", "operator": "contains",
"value": "doot" }]


回答1:


return $http ({
    method: 'GET',
    url: Backand.getApiUrl() + '/1/objects/users',
    params: {
      filter: {
        "q": { 
          { 
            "$or": [ { "firstName": { "$eq": "Megh" } }, { "lastName": {"$like": "doot"} } ]  
          }
        } 
      }
    }
  });

You can read further: http://docs.backand.com/en/latest/apidocs/nosql_query_language/

There is also the "search" parameter that performs a free text search on all the textual fields in the object. Useful when you want to provide a free text search in your UI.

return $http ({
        method: 'GET',
        url: Backand.getApiUrl() + '/1/objects/users',
        params: {
          search: "something"
        }
      });


来源:https://stackoverflow.com/questions/36350029/how-can-i-filter-multiple-fields-with-or-in-backand

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!