CB4, Counters meta data now json instead of base64?

I just upgraded to couchbase 4, and all my views that use counters broke.
After some analysis it seems that meta.type has changed for these to be json instead of base64.
is there a reason for that, and how can we successfully filter counters now in a view?

Lennartos,

Unfortunately in Couchbase Server 3.X there was a regression which caused counters to be treated as binary documents. In 4 we fixed this behaviour, you can read more about issue in defect MB-15129.

how can we successfully filter counters now in a view?

Some users prefix their counter documents with counters_ and check for the prefix in the view:

function (doc, meta) {
  if (meta.id.indexOf("counter_") === 0) {
    emit(meta.id, doc);
  }
}