Mongo DB Basic Commands
Mongo DB Basic Commands
Teacher Database.
we are creating Teacher Database. Which contain
the information of Teacher_id, name of a teacher,
department of a teacher, salary and status of a
teacher. Here status is whether teacher is approved
by the university or not.
Database Database
Table Collection
Row Document 0r BSON Document
Column Field
Index Index
Table Join Embedded Documents & Linking
Primary Key Primary Key
Specify Any Unique Column Or In Mongodb, The Primary Key Is
Column Combination As Primary Key. Automatically Set To The _Id Field.
sqlplus mongo
Database Client mysql
Table Creation in Oracle
CREATE TABLE Teacher_Info( Teacher_id Varchar(10), Teacher_Name
Varchar(10),
Dept_Name Varchar(10), Salary Number(10), Status char(1), PRIMARY KEY (id) );
SQL:
INSERT INTO TeacherInfo(Teacher_id, Teacher_Name, Dept_Name, Salary, Status)
VALUES (“Pic001", “Ravi”, “IT”,30000, “A");
INSERT INTO TeacherInfo(Teacher_id, Teacher_Name, Dept_Name, College_Name,
Status) VALUES (“Pic002", “Mangesh”, “IT”,20000, “A");
INSERT INTO TeacherInfo(Teacher_id, Teacher_Name, Dept_Name, Salary,
Status) VALUES (“Pic003", “Akshay”, “Comp”,25000, “N");
o/p
Teacher_Info
Teacher_id Teacher_Name Dept_Name Salary Status
MongoDb:
At the document level, update() operations
can add fields to existing documents using
the $set operator.
Ex:
db.Teacher_info.update( { }, { $set: { join_date:
new Date() } }, { multi: true} )
Drop Command:
Oracle:
DROP TABLE Teacher_info
Mongo:
db.Teacher_info.drop()