In MongoDB, we can limit the number of documents that we want by using limit() method. This method takes one number and returns only that number of documents. Similar to limit(), we also have another method called skip() to skip the starting values. This method is defined as below :.
ReadIn this tutorial, we will learn how to use the limit() method in MongoDB with different examples. limit() method is used to fetch only a specific number of documents. This method takes one number, i.e. the number of documents that you want to fetch. You can use it on find().
ReadSometimes you may need to change the port of mongod instance running in your system. The default port is 27017 and it is used by default if you are running mongod. This port is used by both mongod and mongos instance.
ReadTrimming is used to remove whitespace characters from a string. Javascript provides us different methods to remove whitespaces from the start, end and both sides of a string. Whitespace is any whitespace character like tab, space, LF, no-break space, etc.
ReadThe substr function is used to get one substring from a string in Javascript. In this example, we will learn how to use the substr method in Javascript with examples.
ReadIn this tutorial, we will learn how to find the second-highest number in an array in C++. The program will take the array elements as input from the user. It will then find out the second-highest element and print it out.
ReadIn this tutorial, we will learn how to find the power of a number in C++. We can use one loop to find the power or C++ provides one method called pow() to find the power.
ReadPython OS module provides different methods to perform different operating system tasks like create a directory, delete a directory, etc. In this post, we will learn how to check if a directory exists or not and to create one directory if it doesn't exist.
ReadIn this tutorial, we will learn how to reverse a number in C++ using one loop. We will use one while loop to reverse the number. The program will read the number as input from the user, reverse it and print it to the user.
ReadComments are important. It makes the code more readable. Comment is supported in all programming languages. In C++, comments are categorized into two types. In this tutorial, I will show you how to write comments in a C++ program. Always try to write comment in your code. It is a good development practice.
Read