(sorry for the newbie question, but can't find it easily in documentation)
I want to have a document store with a few models, and then use some of the attributes as parameters in queries, in my Foxx services. Say I have a db for movies and series episodes:
{
'type':'movie',
'year':'1997',
'director':'xxxxxxx',
...
},
{
'type':'series_episode',
'season':'1',
'episode':'3',
...
}
...
I need to be able to search on
Of course what I would like to do is to have a single router that would support both GET /?type=movie&year=x&director=y.. GET /?type=series&season=x&episode=y Is that possible? Easy to do?
I couldn't find out, so I started thinking that I have to have different routers for each of the types, like this:
router.get('/movies', function (req, res) {
const data = db._query('FOR entry IN mystore FILTER entry.type == @type, entry.year == @year RETURN entry ',
{'type':'movie', .....});
res.json({
result: data
})
});
router.get('/series', function (req, res) {
const data = db._query('FOR entry IN mystore FILTER entry.type == @type, entry.season == @season, entry.episode == @episode, RETURN entry ',
{'type':'series', .....});
res.json({
result: data
})
})
That would be heavy work to maintain. Ideally I would just update the models and use one single router.
Even for this last option I had a question: How do i pass more than one parameters to the query? I can't find the syntax.
Any help is appreciated. I am learning ArangoDB and I am very interested in the potential, but I can't navigate around the documentation I saw or examples.
Thank you