Page 1 of 2

How to create a query in the Tiggzi database query screen

Posted: Mon Aug 27, 2012 8:03 am
by Gail

I see the Query button in my Tiggzi database screen, but I can't seem to figure out what query language you're using. I'm used to querying with SQL, but when I enter an sql query, I just get an "Incorrect Query" message.

Do you have an example, tutorial or link to the database query format/syntax/language I should use?

I would like to do something simple like:
SELECT column1_name FROM my_table_name WHERE (_localvariable is = column2_name AND _localvariable is startdate AND _solddate <= enddate


How to create a query in the Tiggzi database query screen

Posted: Mon Aug 27, 2012 8:41 am
by Maryna Brodina

How to create a query in the Tiggzi database query screen

Posted: Mon Aug 27, 2012 8:29 pm
by Gail

Thanks, that helps a lot, but I'm still confused about the QUERY box (see attached image.) What exactly goes into it? If I use the very last example on the bottom of the page for the link you suggested, here is the following query code (from that page.)

curl -X GET \
-H "X-Tiggzi-Database-Id: 4ffcf6c8e4b0211629c4ad01" \
--data-urlencode 'count=1' \
https://api.tiggzi.com/rest/1/db/coll...

I tried putting this into the QUERY box and running the query (changing the todo at the end of the url to the name of my own collection), but I just get the incorrect query message.

I also tried it by just putting the following line of code in the QUERY box:
--data-urlencode 'count=1'

But that didn't work either. I also tried:
'count=1'
But that didn't work. I just keep getting the Incorrect Query message.

Would you please tell me what part of the Query syntax is supposed to go into that QUERY box in the database?
Image


How to create a query in the Tiggzi database query screen

Posted: Mon Aug 27, 2012 8:46 pm
by maxkatz

Here is an example:

Image

Running {"sometext":"hello"}:

Image


How to create a query in the Tiggzi database query screen

Posted: Wed Aug 29, 2012 2:01 am
by Gail

Thanks, that helps. But the linked help page you suggested doesn't give the syntax or an example for querying for a date and also how to use the AND operator.

Here is the query I'm trying to do, and I get "incorrect query" message:
{YearStartDate : {"$gt": 1906-01-25} AND YearEndDate : {"$lt": 1907-02-12 0} }


How to create a query in the Tiggzi database query screen

Posted: Wed Aug 29, 2012 2:47 am
by maxkatz

Try: {"YearStartDate":{"$gt":"1906-01-25","$lt":"1907-02-12"}}


How to create a query in the Tiggzi database query screen

Posted: Fri Aug 31, 2012 12:18 am
by Gail

I have a YearStartDate of 1906-01-26 and the query you suggested didn't work. HOWEVER, What I really want to to do is use two different column names: YearStartDate and YearEndDate and I want the query to return records that have an input parameter between (and including) the start date and the end date. I am storing the input parameter date in a local variable called _inputdate

I was just trying to work out the query with the database before I tried to introduce the local variable into it.

So, in the Query box, I tried this:
{ {"YearStartDate":{"$gte":"1906-01-25"} } , {"YearEndDate":{"$lte":"1907-02-12"} } }
I realize this doesn't have the local variable input parameter in it. However, despite the fact that I do have a data record which fits the query criteria, no data is returned.


How to create a query in the Tiggzi database query screen

Posted: Fri Aug 31, 2012 9:33 am
by Maryna Brodina

Hello!
This should help http://www.mongodb.org/display/DOCS/A...

Please try this query {$and:[{"YearStartDate":{"$gte":"1906-01-25"} } , {"YearEndDate":{"$lte":"1907-02-12"} }]}


How to create a query in the Tiggzi database query screen

Posted: Sun Sep 09, 2012 5:49 am
by Sam K

I was able to filter..how do you get a valid query for sorting. I have tried
{sort( { myid : -1 } )}
{order:{myid}}
and other variations of the this query command - but no luck
I would like to put that in the Request parameters of the service call eventually and would like to sort by _updatedAt field descending.
Thanks


How to create a query in the Tiggzi database query screen

Posted: Sun Sep 09, 2012 6:52 am
by maxkatz

Let us know if this helps: http://help.tiggzi.com/documentation/...