N1QL query for document + count

I found this earlier reply, that that works for me.