mongoose-elasticsearch-xp
mongoose-elasticsearch-xp copied to clipboard
es_extend and promise
Would it be possible to support promises with es_extend's value? I would like to add related document count with a query like:
{
es_extend: {
commentCount: {
es_type: 'integer',
es_value: document =>
mongoose.models.Comments
.count({ 'post.id': document._id })
.exec(),
},
},
},
Reason for this is that I would like show comment count along the post list. Also, I'm interested if there is a better way to achieve the same end result.
No idea when I'll have bandwidth, but I'll keep it in mind...
I think commentCount
should be a regular Number
field you update each time you receive a new comment from your controller.
@michelem09 your url on your github account doesn't work (http://www.michelem.org)
I tried with some online tools and it seems to work fine, but thanks I will update the http(s)
I'm redirected to https://www.michelem/ without the .org
Sh*t! You are right. Fixed. Thanks!
:D you're welcome