{"id":20276207,"url":"https://github.com/prathmesh-ka-github/learning-mongodb","last_synced_at":"2026-05-10T13:07:20.426Z","repository":{"id":227090559,"uuid":"770414195","full_name":"prathmesh-ka-github/Learning-mongodb","owner":"prathmesh-ka-github","description":"Learning MongoDB. MongoDB is a source-available, cross-platform, document-oriented database program.","archived":false,"fork":false,"pushed_at":"2024-03-11T16:15:49.000Z","size":201,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T06:32:58.238Z","etag":null,"topics":["database","dbms","mongodb","mongodb-atlas","mongodb-database","nosql","rdbms"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prathmesh-ka-github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-11T14:08:31.000Z","updated_at":"2024-03-11T16:15:29.000Z","dependencies_parsed_at":"2024-03-11T16:13:45.942Z","dependency_job_id":"5153f410-f819-4aa6-b281-56940c0c507c","html_url":"https://github.com/prathmesh-ka-github/Learning-mongodb","commit_stats":null,"previous_names":["prathmesh-ka-github/learning-mongodb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathmesh-ka-github%2FLearning-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathmesh-ka-github%2FLearning-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathmesh-ka-github%2FLearning-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prathmesh-ka-github%2FLearning-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prathmesh-ka-github","download_url":"https://codeload.github.com/prathmesh-ka-github/Learning-mongodb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768285,"owners_count":20017116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","dbms","mongodb","mongodb-atlas","mongodb-database","nosql","rdbms"],"created_at":"2024-11-14T13:12:51.800Z","updated_at":"2026-05-10T13:07:15.389Z","avatar_url":"https://github.com/prathmesh-ka-github.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning MongoDB.  \n#### MongoDB is a source-available, cross-platform, document-oriented database program. Classified as a NoSQL database product, MongoDB utilizes JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and current versions are licensed under the Server Side Public License.  \n\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"image-1.png\" /\u003e\n\u003cp/\u003e\n\n\n### Basic commands for MongoDB Shell.\n1. To show Databases -\n```\n\u003e show dbs\n```\n\n2. To use/connect to a Database OR to make new Databse -\n```\n\u003e use database-name\n```\n\n3. To make new collection  -\n```\n\u003e db.createCollection(\"collection-name\")\n```\n\n4. To drop a Database (you need to be in that database) -\n```\n\u003e use school\n\u003e db.dropDatabase()\n    //deletes current database\n```\n\n5. Inserting document in a database. In MongoDB we save data by inserting documents in the collection. Same as key:value pairs in JSON -\n```\n\u003e use school\n    //using database school.\n\n\u003e db.createCollection(\"students\")\n    //creating new collection named students.\n\n\u003e db.students.insertOne({name:'Spongebob', age:30, gpa:3.2})\n    //inserting one document into the collection.\n```\n\n6. To show contents of a collection.\n```\n\u003e db.students.find()\n\n//multiple fiters\n\u003e db.students.find({gpa:4.0, fullTime:true})\n```\n\n7. Projection.\n\n```\n//syntax\n\u003e db.students.find({-filter-}, {-projection-})\n\n\n//examples\n\u003e db.students.find({fullTime:true}, {name:true, _id:false})\n\n\u003e db.students.find({}, {name:true, gpa:true, _id:false})\n``` \n\n8. Sorting and limiting.  \n```\n//syntax\n\u003e db.-collectionName-.find().sort({-field- : -ascending(1) and decending(-1)-})\n\n\u003e db.-collectionName-.find().limit(-limitNumber-)\n\n\n\n//examples\n\u003e db.students.find().sort({name:1})\n    //this will sort the outputs by name and ascending order\n\n\u003e db.students.find().limit(2)\n    //this will limit results to 2\n\n//both sorting and limiting\n\u003e db.students.find().sort({gpa:1}).limit(5)\n```\n\n9. Update fields.\n```\n//update one\n//syntax\n\u003e db.students.updateOne({-selection criteria-}, {$set:{-update field:value-}})\n\n\n//examples\n\u003edb.students.updateOne({name:'Spongebob'}, {$set:{fullTime:true}})\n\n\n//update many\n//syntax\n\u003e db.students.updateMany({-selection criteria-}, {$set:{-update field:value-}})\n\n//examples\n//$exists checks if does the document has that field.\n\u003e db.students.updateMany({fullTime:{$exits:false}}, {$set:{fullTime:true}})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathmesh-ka-github%2Flearning-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprathmesh-ka-github%2Flearning-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathmesh-ka-github%2Flearning-mongodb/lists"}