I am using documentdb & running query of documentdb. my sample query is looks like:
studentQuery = {
query: 'SELECT * FROM root r WHERE (r.userid=@userid OR r.code=@code) AND r.collectionName="students"',
parameters: [{
name: '@userid',
value: userid
}, {
name: '@code',
value: code
}]
};
Now problem is that if I am passing only userid="piyush123" and code= "", then it is returning me all those records which has code="" empty value, if code is undefined though it returns all those documents which doesn't contain code.
shortly I don't want those records which has null or empty string or undefined value, I can resolve it by IS_DEFINED, IS_NULL, NOT IS_NULL kind of keywords, but I don't want to use it in all queries 'cause its making my query structure to complex, so I want to apply it at once place so I should not bother about all kind of check everywhere which can reduce my efforts.