Skip to content

Commit 23c16a7

Browse files
author
Hans Kristian Flaatten
committed
feat(api): add magic __no_skip__ option to each()
If you are doing "destructive" operations to your current filter, traversing a collection using the `skip` parameter will essentially «skip» half of the collection (without you knowing it) unless you use the new `__no_skip__` option.
1 parent 73118a1 commit 23c16a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ let request = module.exports._requestDefaults();
5353
return done(null);
5454
}
5555

56-
query.skip += query.limit;
56+
if (!query.__no_skip__) {
57+
query.skip += query.limit;
58+
}
59+
5760
module.exports[type].each(query, callback, done);
5861
});
5962
});

0 commit comments

Comments
 (0)