{"id":523,"date":"2018-04-20T11:53:15","date_gmt":"2018-04-20T11:53:15","guid":{"rendered":"http:\/\/www.codeinsightacademy.com\/blog\/?page_id=523"},"modified":"2019-12-31T04:15:02","modified_gmt":"2019-12-31T04:15:02","slug":"mongodb","status":"publish","type":"page","link":"https:\/\/codeinsightacademy.com\/blog\/big-data\/mongodb\/","title":{"rendered":"MongoDB"},"content":{"rendered":"<p><strong>Start Service<\/strong><\/p>\n<p>sudo service mongod start<\/p>\n<hr \/>\n<p><strong>Start mongo terminal<\/strong><\/p>\n<p>mongo<\/p>\n<hr \/>\n<p><strong>Show databases<\/strong><\/p>\n<p>show dbs<\/p>\n<hr \/>\n<p><strong>Show current database name<\/strong><\/p>\n<p>db<\/p>\n<hr \/>\n<p><strong>Show collections in database<\/strong><\/p>\n<p>show collections<\/p>\n<hr \/>\n<p><strong>Insert:<\/strong><\/p>\n<p>db.collection.insert({})<\/p>\n<hr \/>\n<p><strong>Insert multiple:<\/strong><\/p>\n<p>db.collection.insert([{1}, {2}])<\/p>\n<hr \/>\n<p><strong>Select \/ Find<\/strong><\/p>\n<p>db.collection.find()<\/p>\n<p>db.collection.find().pretty()<\/p>\n<p>db.collection.find({key:val,key:val})<\/p>\n<hr \/>\n<p><strong>Update:<\/strong><\/p>\n<p>db.collection.update({key:val}, {$set: {key:val}}, {multi:true})<\/p>\n<hr \/>\n<p><strong>Delete:<\/strong><\/p>\n<p>db.collection.remove({key:val})<\/p>\n<hr \/>\n<p><strong>Connection with Node.js<\/strong><\/p>\n<p>npm\u00a0install mongodb -g<\/p>\n<p>npm\u00a0link mongodb<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Start Service sudo service mongod start Start mongo terminal mongo Show databases show dbs Show current database name db Show collections in database show collections Insert: db.collection.insert({}) Insert multiple: db.collection.insert([{1}, {2}]) Select \/ Find db.collection.find() db.collection.find().pretty() db.collection.find({key:val,key:val}) Update: db.collection.update({key:val}, {$set: {key:val}}, {multi:true}) Delete: db.collection.remove({key:val}) Connection with Node.js npm\u00a0install mongodb -g npm\u00a0link mongodb &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":869,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/523"}],"collection":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/comments?post=523"}],"version-history":[{"count":6,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/523\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/523\/revisions\/529"}],"up":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/869"}],"wp:attachment":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/media?parent=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}