Searching in rest-io
routes the query to the mongoose find
. GET
query parameters are converted to
find parameters.
The query is build from the GET
parameters. You can provide a regex
or a mongo query operator
.
Sub resources recursively adds end points to search. A child
resource will expose an end point on
a parent
, grandparents
and on the root
of the api.
End points:
/api/grandparents/:grandparentid/parents/:parentid/childs
/api/grandparents/:grandparentid/childs
TODO/api/childs
Resource: /api/grandparents
[{
"_id": "gp1",
"firstName": "Tywin",
"lastName": "Lannister",
"age": 60
}, {
"_id": "gp2",
"firstName": "Joanna",
"lastName": "Lannister",
"age": 55
}]
/api/grandparents?firstName=Tywin
[{
"_id": "gp1",
"firstName": "Tywin",
"lastName": "Lannister",
"age": 60
}]
/api/grandparents?firstName=/tywin/i
[{
"_id": "gp1",
"firstName": "Tywin",
"lastName": "Lannister",
"age": 60
}]
/api/grandparents?age={"$gt":56}
[{
"_id": "gp1",
"firstName": "Tywin",
"lastName": "Lannister",
"age": 60
}, {
"_id": "gp2",
"firstName": "Joanna",
"lastName": "Lannister",
"age": 55
}]