Professional Documents
Culture Documents
Adt Experiment No-2
Adt Experiment No-2
THEORY:
1) CREATE DATABASE:
MongoDB use DATABASE_NAME to
create database. The command will create
a new database if it doesn’t exist,
otherwise it will return the existing
database.
Example:
2) DROP DATABASE:
Dropping a database means deleting
the database and also deleting all the
associated data files.
The command used for deleting a
database is dropDatabase.
Syntax: db.dropDatabase()
Example:
3) CREATE COLLECTION:
MongoDB.db.createCollection (name,
options) is used to create collection.
In the command, name is name of
collection to be created. Options is a
document and is used to specify
configuration of collection.
Syntax: db.createCollection(name,
options)
Example:
4) DROP COLLECTION:
Syntax: db.COLLECTION_NAME.drop()
Example:
CONCLUSION: