Reputation: 374
This is the map reduce function I am using right now
public static final String UNIQUE_ASSET_COUNT_VIEW = "function (doc, meta) { \n"
+ " if(doc.type == \"nikhil\") { \n"
+ "emit();
I want to make this dynamic as it will change according to the type of document. Right now I am not able to do this. Is there any way to achieve this. I am using Couchbase 5.x
Upvotes: 1
Views: 107
Reputation: 2460
Views are on their way out in Couchbase, you should create an index instead if you are running on +5.5.x.
Since this version, we can push all aggregations down to the index: https://blog.couchbase.com/new-querying-features-couchbase-server/
If you are using Spring data, you could add the annotations @ViewIndexed (if you really want to use views) or @N1qlPrimaryIndexed.
Upvotes: 1