Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

query multiple columns and return everything greater then 0

Hello

I need to help my query. I have read everything and cannot figure it out

I have 6 colums
[
{
"_id":"54c163f6e4b0ae7c7ace2af7",
"day":"Monday",
"f1":0.0,
"f2":20.0,
"f3":20.0,
"f4":20.0,
"f5":20.0,

I need to return the day Column if it says Monday and only the columns greater then 0.

I have tried dozen of queries but I cant figure it out.

return '{"$or":[{"day":{"$regex":"^'Monday'", "$options":"i"}},{"f1":{"$regex":"^'0'", "$options":"i"}}]}';

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

query multiple columns and return everything greater then 0

Hi Vinny,

You can not return only columns greater then 0. You can return all columns of the item.

But you can filter items with needed criteria.

In you case you need to use "$and" clause and logic.

pre

var whereObject = {
"$and": [
{"day": "Monday"},
{"f1": {"$gt": 0} }
]
};

return JSON.stringify(whereObject);

/pre

Regards.

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

query multiple columns and return everything greater then 0

Not exactly what I was looking for but its close.

I need to return the row Monday and f1, f2, f3, f4 that are greater then zero.

So the list doesnt show any quantities that are zero.

Image

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

query multiple columns and return everything greater then 0

how about hiding results that have a zero number value

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

query multiple columns and return everything greater then 0

Hello Vinny -

We are looking into this issue. Bruce has suggested you the right approach, but in your case, I think it needs additional manipulations with jQuery - https://getsatisfaction.com/apperyio/...

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

query multiple columns and return everything greater then 0

any ideas?

is it at all possible?

Return to “Issues”