Skip to content

Commit

Permalink
refactor: add options for search (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
jannyHou authored Nov 19, 2019
1 parent a113a5c commit c395f92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/couchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ CouchDB.prototype.all = function all(model, filter, options, cb) {
cb();
}
};
self._findRecursive(mo, query, docs, include, function(err, result) {
self._findRecursive(mo, query, docs, include, options, function(err, result) {
if (err) return cb(err, result);
cb(null, result.docs);
});
Expand Down Expand Up @@ -1073,7 +1073,7 @@ CouchDB.prototype._buildFilterArr = function(k, props) {
* @param {Object} include Include filter
* @callback {Function} cb The callback function
*/
CouchDB.prototype._findRecursive = function(mo, query, docs, include, cb) {
CouchDB.prototype._findRecursive = function(mo, query, docs, include, options, cb) {
var self = this;
mo.db.find(query, function(err, rst) {
debug('CouchDB.prototype.all (findRecursive) results: %j %j', err, rst);
Expand All @@ -1096,7 +1096,7 @@ CouchDB.prototype._findRecursive = function(mo, query, docs, include, cb) {
}
include(rst.docs, function(err) {
if (err) return cb(err);
self._extendDocs(rst, docs, query, mo, include, cb);
self._extendDocs(rst, docs, query, mo, include, options, cb);
});
});
};
Expand All @@ -1108,7 +1108,7 @@ CouchDB.prototype._findRecursive = function(mo, query, docs, include, cb) {
* @param {Object[]} docs Model document/data
* @callback {Function} cb The callback function
*/
CouchDB.prototype._extendDocs = function(rst, docs, query, mo, include, cb) {
CouchDB.prototype._extendDocs = function(rst, docs, query, mo, include, options, cb) {
var self = this;
if (docs.length === 0 && rst.docs.length < 200) return cb(null, rst);
for (var i = 0; i < rst.docs.length; i++) {
Expand All @@ -1120,7 +1120,7 @@ CouchDB.prototype._extendDocs = function(rst, docs, query, mo, include, cb) {
cb(null, rst);
} else {
query.bookmark = rst.bookmark;
self._findRecursive(mo, query, docs, include, cb);
self._findRecursive(mo, query, docs, include, options, cb);
}
} else {
cb(null, rst);
Expand Down

0 comments on commit c395f92

Please sign in to comment.