In backbone.js, my understanding of communication with the server to retrieve data is cloudy at best... My current confusion is:
When you use a Collection you can fetch a set of data from the database through the Model and filter out unwanted results. My concern with this is that in an instance where the unfiltered results ends up being millions of results long, this would slow things down.
I know this must not be the case of how it functions because others use backbone.js and I haven't seen this complaint before.
QUESTION: Through backbone.js, when you fetch a set of objects where does it communicate to and how do you pass variables to specify filters for the method? For example, call to a get method that could take a user_id to return objects with the associated user_id.
If this is not the correct approach please let me know.
Explanation of how backbone.js communicates with the server, what type of interface it expects to communicate. Examples would also be very helpful.
Any help is greatly appreciated.
In the documentation there's a bit where you can pass in jQuery options. In those options you can set the "data" parameter, which is passed in as query parameters or as form parameters, depending on if it's a POST or GET.
jQuery.ajax options can also be passed directly as fetch options, so to fetch a specific page of a paginated collection: Documents.fetch({data: {page: 3}})