Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
112. Searching for Documents
Play lesson

Full Stack Web Development Tutorial Course - 112. Searching for Documents

4.0 (3)
36 learners

What you'll learn

This course includes

  • 26.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Week 3: Day 2 Section 12: Intro to Node, Mongo, & REST APIs Tutorial 112: Searching for Documents In this video tutorial, we are going to see some more commands used in MongoShell. LECTURE CONTENT 00:00:00 Introduction 00:01:45 Finding a document using its Id 00:02:06 Finding a data using its name 00:04:42 Updating a document 00:07:55 End The commands are as follows: Update- To update a document, MongoDB provides update operators, such as $set, to modify field values. Command: Database.collection.update({ field1: value1, ... }) Example: db.products.update({"product name": car},{ $set:"price": 12,00,00}) Some update operators, such as $set , will create the field if the field does not exist. Command: db.collection.updateOne() It is used to update a single existing document in the collection. Command: db.collection.updateMany() It is used to update many documents in an existing collection. FindOne- It is used to find specific data or query in the collection. Command: db.collection.findOne({query}) Some Of the commands learned in the previous video are: To see all the databases in your system Command: show dbs Example: show dbs Result: Local 0.78125GB Test 0.23012GB It will show all the databases present in your system. To check your currently used database Command: db It will display the name of the currently used database. To create a new database Command: use DATABASE_NAME Example: To create a database with the name Xyz Syntax: use Xyz Your created database is not present in the list when you enter - show dbs. To display the newly created database, you need to insert at least one document into it. Command: db.collection_name.insert({ "description1":name1,"description2":name2}) Example: dbs.products. insert({"product name":car,"price":10,20,000}) To select documents in a collection Command: db.collection.find() Example: db.products.find({"product name":car,"price":10,20,000}) To format the printed result,you can add .pretty() to the operation Command: db.collection.find().pretty() Some of the important terms to learn while using MongoDB: Server- A server is a computer that provides data to other computers. It is connected to other devices through LAN or WAN. There are different types of servers and each type runs specific software according to the purpose of the server. Terminal- It is an electronic or electromechanical hardware device that can be used for entering data into and transcribing data from a computer and computing device. App.use- it is a way to register middleware or chain of middlewares before executing any end route logic or intermediary route logic depending upon the order of the middleware registration sequence. Express/express.js- it is a back end web application framework for node.js. It is free and open-source software. It is designed to build web applications and APIs. Npm- It is the package manager for the Node Javascript platform. It is used to publish, discover, install, and develop node programs. JSON- Javascript Object Notation is an open standard file format and data interchange format. It is commonly used for transmitting data in web applications. Body parser- It allows express to read the body and then parse that into a JSON object that we can understand. Full Stack Web Development in Just 3 weeks Published by WB Web, Under free promotions, Watch All the videos for free for a limited time. You can buy the course from Udemy for lifetime access. Udemy Course Link: https://www.udemy.com/ultimate-web/ Content Credit: Mark Price https://www.devslopes.com/ Hosted By WB Web Development Solutions

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere