MongoDB for SQL users

Writing by on Thursday, 18 of December , 2014 at 11:42 pm

Here’s a Quick Reference to get started

Description SQL Mongo DB  
Lingo 1 Table; Relation Collection  
Lingo 2 Row; Record; Tuple Document  
List Databases SHOW databases show databases  
List Tables SHOW tables show collections  
Switch to a DB USE db use db  
Show Table Data SELECT * FROM table db.collection.find.pretty()  
Filter Table Data WHERE colum = 'value' db.collection.find({'column':'value'})  
Select Columns SELECT col1, col2 db.collection.find({},{col1:1, col2:1})  
Delete Rows DELETE FROM table WHERE col='val' db.collection.remove({'col':'val'})  
Get Rid of a Table DROP table db.collection.drop()  
       

Leave a comment

Category: MongoDB,SQL DB

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.