Moving App Logic to the Server: How to Query the Database From Server Code Script
An Appery.io developer posted a question on the Appery.io Facebook page on how to write a Server Code script to query two different collections in the database. This post will show you how to do that.
In general, querying two database collections is better to do on the server-side than from the client. Doing it on the server is a lot faster and provides you with the option to update the search without impacting the client. Plus, you can add any logic when needed. Doing it from the client would require two REST API calls to the database.
Let’s jump into the example.
First, there are two collections in the Appery.io Database. They look like this:
ProductName collection:

ProductName collection.
This collection is simple. It has a name and a code.
This is the ProductData collection:

ProductData collection.
The code in this collection links the product name to the actual product (Android or iOS device).