Query generator for Appery.io DB

This tool allows to generate simple query for your Appery.io Database. It will save your time and, probably, let you avoid some typos/mistakes during development, especially if you are a beginner.
Tool is not ideal, but it will be improved from time to time. Now it has only AND and OR operators, but for “_createdAt” and “_updatedAt” columns queries generates as Appery.io Database demands it.
We hope it will be useful.


6 thoughts on “Query generator for Appery.io DB”

  1. Hi I need to query a collection

    with two pointers

    heres what ive got but it does nothing
    var getEEImage = {“$and”: [
    {“ExerciseID”: {“$inQuery” : { “collName”:”level1content”,”_id” : Apperyio(“mobilelabel_exercise_id”).text()}}},
    {“BetaTesterID”:{“$inQuery” : { “collName”:”earlybetatesters”,”_id” : Apperyio(“mobilelabel_BetaTesterID”).text()}}},
    ] };
    return getEEImage;

    1. Hi Jonesey.
      There is no query itself, so I don’t know if you actually called it
      I see 2 issues here: a) complex query – it is better simplify it b) inQuery is redundant.
      So I would wrote it like this:
      var exercise_id = Apperyio(“mobilelabel_exercise_id”).text();
      var BetaTesterID = Apperyio(“mobilelabel_BetaTesterID”).text()
      var getEEImage = {“$and”: [
      {“ExerciseID”: { “collName”:”level1content”,”_id” : exercise_id }},
      {“BetaTesterID”: { “collName”:”earlybetatesters”,”_id” : BetaTesterID }},
      ] };
      return getEEImage;

  2. Hi,
    I’m trying to query elements created on a given day. I’ve created two Date objects to compare against, one is set at 00:00:00:0000 of that day and the other is set at 23:59:59:999. I thought of using the $and operator to accomplish this, but I am having trouble building a query for the embedded $date operator.

    var params = {}; // Specifies a given user’s entries with user_id given date
    params.criteria =
    “user_id”: {
    “$eq”: user_id
    “_createdAt”: {
    “$and”: [{“$gte”: {
    “$date”: d1 // Sun, 19 Jan 2020 08:00:00 GMT
    }},{ “$lte”: {
    “$date”: d2 //Mon, 20 Jan 2020 07:59:59 GMT

    }; // When queried, returns undefined

    1. Hi Alan,
      Try to change user part from
      “user_id”: {
      “$eq”: user_id

      to simply
      “user_id”: user_id,

    2. Alan,
      2 small tips:
      1) server is running in UTC not GTm
      2) when you finished building your query try it out in DB, by opening DB query on the collection page, if something is not working or results are empty try to simplify the query, eventually you will find solution

Leave a Reply

Your email address will not be published. Required fields are marked *