How to find all the values of particular key of MongoDB Database using Node.js ? Last Updated : 12 Feb, 2021 Comments Improve Suggest changes Like Article Like Report MongoDB module: This module of Node.js is used for connecting the MongoDB database as well as used for manipulating the collections and databases in MongoDB. The mongodb.connect() is the main method that is used for connecting to the MongoDB database which is running on a particular server on your machine (Refer to this article). We can also use promises, in this method to resolve the object contains all the methods and properties required for collection manipulation and reject the error that occurs during connection. Project() method of MongoDB module is allowed only documents that specified as a parameter in this Method. This Method takes the document's key name and with 0 and 1 value. 0 means except this key show all other's keys value of MongoDB Collection.1 means show only given keys value. Of MongoDB Collection.Installing module: You can install the mongodb module using the following command: node install mongodbProject Structure: The project structure will look like the following. Running the server on Local IP: In the following command, data is the folder name. mongod --dbpath=data --bind_ip 127.0.0.1MongoDB Database: Our database name and collection is shown below with some dummy data. Database:GFG Collection:aayushFilename: index.js JavaScript // Requiring module const MongoClient = require("mongodb"); // Connection URL const url = 'mongodb://localhost:27017/'; // Database name const databasename = "GFG"; MongoClient.connect(url).then((client) => { const connect = client.db(databasename); // Connect to collection const collection = connect.collection("aayush"); // Fetching the records of name key collection.find({ }).project({name:1}) .toArray().then((values) => { // Printing the values console.log(ans); }); }).catch((err) => { // Printing the error message console.log(err.Message); })  Run the index.js file using the following command: node index.jsOutput: Comment More infoAdvertise with us Next Article How to find all the values of particular key of MongoDB Database using Node.js ? Z zack_aayush Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 Node.js-Misc +1 More Similar Reads How to find all the document keys of MongoDB using Node.js ? MongoDB, the most popular NoSQL database, is an open-source document-oriented database. The term âNoSQLâ means ânon-relationalâ. It means that MongoDB isnât based on the table-like relational database structure but provides an altogether different mechanism for storage and retrieval of data. This fo 1 min read How to sort collection of MongoDB Database in descending order using Node.js ? MongoDB, the most popular NoSQL database, is an open-source document-oriented database. The term âNoSQLâ means ânon-relationalâ. It means that MongoDB isnât based on the table-like relational database structure but provides an altogether different mechanism for storage and retrieval of data. This fo 2 min read How to add range in the Collection of Mongodb using Node.js ? Mongoose.module is one of the most powerful external module of the node.js.Mongoose is a MongoDB ODM i.e (Object database Modelling) that used to translate the code and its representation from MongoDB to the Node.js server.Mongoose module provides several functions in order to manipulate the documen 2 min read How to get information of all databases present in MongoDB using Node.js ? MongoDB, the most popular NoSQL database, we can count the number of documents in MongoDB Collection using the MongoDB collection.countDocuments() function. The mongodb module is used for connecting the MongoDB database as well as used for manipulating the collections and databases in MongoDB. Inst 1 min read How to Connect to a MongoDB Database Using the Node.js Driver ? MongoDB is a popular, open-source, NoSQL (non-relational) database that provides high performance, high availability, and easy scalability. Unlike traditional relational databases, MongoDB stores a JSON-like format called BSON (Binary JSON). In this article, we connect the MongoDB database to your b 4 min read Like