Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Mobile Backend Services (MBS) provides APIs for querying and searching for MBS objects. The query APIs allow you to perform custom database-style searches, while search APIs perform a full-text search using the MBS search engine.

...

Currently, MBS does not support case insensitive queryqueries. To perform a case-insensitive query on a field, save an additional normalized copy of the original field and perform the query on the normalized field instead.

...

Assign an array of field names to filter to the all field to search all JSON fields including fields in nested objects. Currently, this is the only supported option.

If you want to hide displaying a field from the custom_field object, simply pass the field name of the custom_field object.

...

  • Query on Custom Field, Results in Ascending Order
  • Query on Custom Field, Results in Descending Order
  • Query for Next Page of Results, Results in Ascending Order
  • Query for Previous Page of Results

Query on a custom field, results in ascending order

In this example, the query returns Statuses objects whose custom score field is less than 100 , and sorts results on the score in ascending order (&order=score). The query matches 100 total records.

Code Block
languagejs
collapsetrue
~ curl -d 'where={"score":{"$lt":100}}&order=score' -X GET 
"http://<HOST>:8082/v1/statuses/query.json?key=<KEY>&count=true&pretty_json=true"
{
  "meta": {
    "code": 200,
    "status": "ok",
    "method_name": "queryStatuses",
    "count": 100
  },
  "response": {
    "statuses": [
      {
        "id": "53fe1c25759220e9f675413a",
        "custom_fields": {
          "score": 0.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f675413b",
        "message": "status",
        "custom_fields": {
          "score": 1.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f675413c",
        "custom_fields": {
          "score": 2.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f675413d",
        "custom_fields": {
          "score": 3.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f675413e",
        "custom_fields": {
          "score": 4.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f675413f",
        "custom_fields": {
          "score": 5.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f6754140",
        "custom_fields": {
          "score": 6.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f6754141",
        "custom_fields": {
          "score": 7.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f6754142",
        "custom_fields": {
          "score": 8.0
        }, ...
      },
      {
        "id": "53fe1c25759220e9f6754143",
        "custom_fields": {
          "score": 9.0
        }, ...
      }
    ]
  }
}

Query on a custom field, results in descending order

In this example, Statuses objects are queried whose custom score field is less than 100 , and sorts results on score in descending order (&order=-score).

...