Sign In Register

How can we help you today?

Start a new topic

Query greater than or less than in noSQL explor

I am trying to run the following query in challengeInstance:



so that I can get all challenges previous to a certain date based on the instructions here,

I always get an error for this.

Also, even if I try to something even simpler such as {"turnBased": "true"}, i always get no results even though there are plenty of challenge instances with turnBased set to true. The only queries i can get working so far are ones querying for a unique value or id.

Hi Jaayden,

You can query date's in NoSQL like so:

{ "startDate": { "$gte": {"$date": "2016-06-01T00:00:00.000Z"}, "$lte": {"$date": "2017-07-02T00:00:00.000Z"}}}


1 person likes this

That works but how could I have known to create a query like that? The mongo db documentation that the GameSparks documentation points to mentions to use $gt and $lt. Is there some other documentation I can reference?

Also, if I just want to a query to find all records (not just a specific record) that match a boolean value or a numeric or string value, how can I do that?

Hi Jaayden,

The gte and lte commands are extensions of gt and lt (which you can also use) that also qualify values equal to the date. 

Querying for bools is done like so:

{"turnBased": true} (No brackets, treat it as a boolean).


Ok makes sense but I have a boolean inside of scriptData called isVisible and doing this with either false or true always returns nothing.


Also, one other query I am trying to do is for accepted. How can I query an array element for records where it is empty or has a specific number of elements? So query where accepted is empty or where accepted has just 1 element?

Hi Jaayden,

Your query must be like this:


You can go read mongodb doc on the subject:

Login to post a comment