I am Hack Sparrow
Captain of the Internets.

JavaScript slice() with Examples

Are you familiar with the JavaScript array slice() method? As you are on this page, I will assume you are not. The slice() method of arrays is a useful function to 'chop off' items from an array. 'Chopping off' better describes the functionality than 'slicing', but probably they settled on slice() because it sound and looks more 'professional' than chopoff(). Array.slice() is a m ...

MongoDB Pagination – using $slice

Another technique of implementing pagination in MongoDB involves the use of $push and $slice. In this method, we store the documents in an array and use the $slice method to accomplish what skip()-and-limit() does, but without the overhead associated with the skip() method. We will be using a single root document in a collection with two fields: i. an arr ...