I ask for your help to be told if it is possible to make a GET petition of a single model by making a set of one or more attributes of the model; I explain myself better:
This is a query that returns a Collection of many models when I do .fetch()
, but what I want is to filter a single model if I need to order all the models and then search for it
{
"ciudadDepartamento": "Bogotá",
"estadoDepartamento": true,
"fechaCreacion": "2016-05-12T00:00:00-05:00",
"id": 1,
"idFacultad": {
"ciudadFacultad": "Bogotá",
"estadoFacultad": true,
"fechaCreacion": "2016-05-12T00:00:00-05:00",
"id": 2,
"nombreFacultad": "Facultad de Ingeniería y Ciencias Básicas"
},
"nombreDepartamento": "Ciencias básicas"
}
I have read the documentation and it says that if I want to bring all the collections I should do GET /books/ .... collection.fetch();
and for the GET /books/1 ... model.fetch();
models, but it does not work for me; What I am doing is:
var modelo = Backbone.Model.extend({"id": 1});
but it returns all the example models:
modelo.toJSON();
0: Object
1: Object
2: Object
3: Object
4: Object
id:1
_proto_