MongoDB – Limit Records In this chapter, we will learn how to limit records using MongoDB. The Limit() Method To limit the records in MongoDB, you need to use limit() method. The method accepts one number type argument, which is the number of documents that you want to be displayed. Syntax The basic syntax of […]
Category Archives: mongodb
MongoDB – Create Database In this chapter, we will see how to create a database in MongoDB. The use Command MongoDB use DATABASE_NAME is used to create database. The command will create a new database if it doesn”t exist, otherwise it will return the existing database. Syntax Basic syntax of use DATABASE statement is as […]
MongoDB – Drop Collection In this chapter, we will see how to drop a collection using MongoDB. The drop() Method MongoDB”s db.collection.drop() is used to drop a collection from the database. Syntax Basic syntax of drop() command is as follows − db.COLLECTION_NAME.drop() Example First, check the available collections into your database mydb. >use mydb switched […]