How to get total rows count of a subset of a view

We are trying to get total rows count of a view filtering with particular key. We admit one problem

  1. No matter whatever key we set the total_rows value remain same

anyone have some explanation? and how to get total rows count of a view filtering with particular key.

Please help…

1 Like

Hi, could you please show us how you do this? Are you using the built in count reduce?

total_rows shows how many rows were indexed by the view. If you want to determine how many rows match your query, you would use a reduce function using the built-in _count reducer. If you want to get the actual rows (rather than just their count), just set reduce=false in your query.

1 Like

Do we have any possibility to create reduce function using rest. Am using cordova-couchbase-lite. plugin.

My map function as follows.

                    couchlite.messages = new $couchbase(url, "test");
                    // 2
                    $scope.message = JSON.stringify("Database Creation");
                    couchlite.messages.createDatabase().then(function (result) {
                    $scope.message = JSON.stringify("Database created");
                        var messageViews = {
                            messages: {
                                map: function (doc) {
                                    if (doc.type) {
                                                 title: doc.title,
                                                 description: doc.description,
                                                 rev: doc._rev,
                                       " ",
                        couchlite.messages.createDesignDocument("_design/message", messageViews);