I'd like to know how can I get a specific field value?
In my mysql :
select *,
(select count(qty) from score where id = a.id) as d_qty
from mlbhitters as a order by no desc
In my mongoose :
this.aggregate([
{
$match:options.query
},
{
$sort:{
no:-1
}
},
{
$limit:options.limit
}
]).exec(callback);
Here is the point that where should I insert sub query in my mongoose?
(select count(qty) from score where id = a.id) as d_qty
MongoDB is hard for me to understand how it works :(