How implement join queries in parse.com javascript? - parse-platform

I am new on parse server ( parse.com ). I have two classes "students_records" and "students_fee". I am storing fee records in class "students_fee" with objectId of "students_records" in column "student_id". Now I want to collect records from both classes by one query similar to join query we do in mysql with base on column 'fee_year' in class "students_fee". for example get all students who have 'fee_year'=2016 and 'student_id'=objectId of "students_records", this is link https://parseplatform.github.io/docs/js/guide/ of guide I am currently getting help, but i can't find such thing. Can anyone tell me how to do that?
Thanks.

Since parse use MongoDB (NoSQL) behind the scenes there is no real "join". What you can do is to create a array relationship from students to records and then use include in your query in order to include all the records under a student.
You can read more about it here.
I recommend you to use Parse SDK's here in order to keep it simple.
the Parse SDK is available for all the popular programming languages (e.g. iOS, Android, PHP, JavaScript and more)

Related

How to simplify Hasura's tracked relationship query responses?

Curious if I constructed and tracked this m2m relationship correctly. Seems strange that every object in those arrays are named "user": {...} or "pip": {...}
Seems like these both should work
Update with screenshots:
Users table relationships:
Pips table relationships:
There's currently no automatic way to "hide" the join table from the GraphQL query and response. You need to traverse through the join table to get back the results you want from both directions so you can't avoid it using the default generated API.
It is possible to extend the GraphQL API using SQL Views if you want to try and "flatten" things from the perspective of people consuming this data.
Alternatively, I'd recommend calling the relationship something different to make it obvious that you're navigating through a join table. I'd recommend actually calling the relationship user_pips instead of pips as it makes it more clear what you're actually retrieving.

What's the best way to store workout information?

I'm playing around with a workout app (android), and want to match workouts to dates. The basic structure is :
Each date has zero or one workouts.
Each workout has one or more exercises.
Each exercise has a name, and one or more sets.
Each set has a weight, and one or more repetitions.
I'm considering a json file, where:
Each date attribute has a list of exercise objects.
Each exercise object has a name, and a list of set objects.
Each set object has a weight attribute and a repetitions attribute.
Thoughts?
If you are doing it with Android, use clases to represent the different entities you have mentioned.
To persist the information inside the phone, I sugest you use the built in sqlite database.
If you plan to build the app as the front end for a rest api or webservice, then yes you can use a json file to exchange informtion with the server. Now, on the server, you would persist the data in a database of your choice. I would go with a relational database like mysql, but for the model you are proposing it would be feasable to also go with a Nosql alternative.

Model with multiple tables

We run two websites, A and B. Each website has its own table, _a_ and _b_ which have exactly the same structure. Yes, I know it's silly, we'll be rewriting them over the course of this year and next.
Using Laravel I need to create a model that will hold both tables content. I don't need any kind of UPDATE or INSERT functionality, I just need to SELECT and use with to access other model information.
Is this possible with Laravel 4.1? I can individually model each table, but that would make it difficult in the future.
I was able to fix this by making using the Repository pattern and merging the results of each model into the get and all functions.

Best approach on allowing users create their own fields

I'm about to embark on a project where a user will be able to create their own custom fields. MY QUESTION - what's the best approach for something like this?
Use case: we have medical records with attributes like first_name, last_name etc... However we also want a user to be able to log into their account and create custom fields. For instance they may want to create a field called 'second_phone' etc... They will then map their CRM to their fields within this app so they can import their data.
I'm thinking on creating tables like 'field_sets (has_many fields)', 'fields', 'field_values' etc...
This seems like it would be somewhat common hence why I thought I would first ask for opinions and/or existing examples.
This is where some modern schemaless databases can help you. My favourite is MongoDB. In short: you take whatever data you have and stuff a document with it. No hard thinking required.
If, however, you are in relational land, EAV is one of classic approaches.
I have also seen people do these things:
predefine some "optional" fields in the schema and use them if necessary.
serialize this optional data to string (using JSON, for example) and write it to text blob.

Software or Service to Automatically Generate Custom Ordered Lists?

Disclaimer: I'm not a programmer, so this question is non-technical and probably very basic. I am just hoping to be pointed in the right direction...
I want to automate the routine process of compiling custom lists of medical questions by matching a question's attribute tags to the attributes of the patient and ailment. I've built an Access DB which generates lists when queried based on these tags. But I also need to set rules to determine the order the questions are returned in. Otherwise the questions are "out of order" and don't make sense.
Is there a better (and ideally browser based) software or service I could use to achieve such search/reporting functionality? Or does I need to find someone who can add this functionality to my access DB?
Thanks in advance!
It kind of depends on how you generate "lists when queried based on these tags".
If you're using sql to select from the database, then it may just be a matter of adding an "order by" to the end of your query:
eg:
Select question_no, question from some_table where patient = 'Freddy'
and tag = 'sick' order by question_no
Generally speaking, however you are retrieving these questions; the easiest way of ordering them is by one or more columns in the table you're storing the questions (or a related table)

Resources