MongoDB – skip() method

MongoDB skip() Method Use skip() method to skip a number of documents. It works MongoDB find() method. Syntax: db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER) Example For example you have 10 documents you collection users. Now get the 2 documents after 5 documents. Like you need to get 6’th and 7’th documents from the collection. db.users.find().limit(2).skip(5) The above query will skin first 5 documents from the collection and then show 2 documents. Output: { “_id” : ObjectId(“59a01c912427abe3470644de”), “id” : 1006, “user_name” : “peter”, “name” : [ { “first_name” : “Peter” }, { “middle_name” : “S” },…

Read More