Skip to content

Commit

Permalink
Update mongodb1.md
Browse files Browse the repository at this point in the history
  • Loading branch information
adimail committed May 21, 2024
1 parent 941f369 commit 041a505
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions docs/DBMS/mongodb1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,6 @@ title: mongodb1
parent: DBMS
---

## Basic Commands

1. show database
```shell
show databases
```

2. switch database
```shell
use <database_name>
```

3. show collections
```shell
show collections
```

4, Create collection
```shell
db.createCollection('NewCollection')
```

5. insert document
```shell
db.<collection_name>.insertOne({<document>})
```

```shell
db.myCollection.insertMany([
{ name: "Charlie", profession: "Doctor" },
{ name: "Diana", hobby: "Photography" }
])
```
6. delete collection
```shell
db.exam_collection.deleteOne({ name: "Alice" })
```
```shell
db.<collection_name>.deleteMany({ name: "Alice" })
```
7. Drop collection (caution)
```shell
db.<collection_name>.drop()
```
## Curd operations

```shell
Expand Down

0 comments on commit 041a505

Please sign in to comment.