I started learning rethinkdb and can't replicate a query that I need using nobrainer+rails.
In the RethinkDB data explorer the query is working (not sure if optimal) but it returns the required result.
r.table("apps").get("1").pluck({'releases':['job_id', 'dists']})
.getField('releases').filter({job_id : '832'})
which returns
[
{
"dists": [
{
"checksum": "3333333" ,
"type": "debug"
}
] ,
"job_id": "832"
}
]
The data that is being queried basically is
{
"id": "1" ,
"name": "blah" ,
"releases": [
{
"branch": "master" ,
"dists": [
{
"checksum": "3333333" ,
"type": "debug"
}
] ,
"job_id": "832"
} ,
{
"branch": "master" ,
"dists": [
{
"checksum": "3133333" ,
"type": "release"
}
] ,
"job_id": "831"
}
Any clues on how to get the same result using nobrainer+rails? I know I can create new modals for releases and use the :has_many... But I would like to know how can accomplish that with this data structure.
Thanks!