Skip to content

Commit 87d6781

Browse files
committed
you're doing great
1 parent 0d12d5e commit 87d6781

File tree

5 files changed

+86
-127
lines changed

5 files changed

+86
-127
lines changed

046_mongodb/04_document/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ show dbs
2525
```
2626

2727
```
28-
db.crayonColors.insert([
28+
db.crayons.insert([
2929
{
3030
"hex": "#EFDECD",
3131
"name": "Almond",
@@ -70,11 +70,11 @@ show collections
7070
```
7171

7272
```
73-
db.crayonColors.find()
73+
db.crayons.find()
7474
```
7575

7676
```
77-
db.crayonColors.drop()
77+
db.crayons.drop()
7878
```
7979

8080
```

046_mongodb/05_query/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ db.customers.find({$or:[
6060

6161
### regex
6262
```
63-
db.crayons.find({name: {$regex: '^A'}})
63+
db.crayons.find({name: {$regex: '^M'}})
6464
```
6565

66+
![regex cheatsheet](regex.pdf)
67+
6668
### pretty
6769
```
6870
db.<collection name>.find().pretty()

046_mongodb/05_query/json-spec.html

Lines changed: 0 additions & 123 deletions
This file was deleted.

046_mongodb/05_query/regex.pdf

42.7 KB
Binary file not shown.

046_mongodb/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,85 @@ db.<collection name>.drop()
114114

115115
## 04_document
116116

117+
#### insert
118+
```
119+
db.<collection name>.insert({document})
120+
```
121+
122+
#### insert multiple
123+
```
124+
db.<collection name>.insert(< [{document}, {document}, ..., {document}] >)
125+
```
126+
pass in an array of documents
127+
128+
#### example
129+
```
130+
use playroom
131+
```
132+
133+
```
134+
db
135+
```
136+
137+
```
138+
show dbs
139+
```
140+
141+
```
142+
db.crayons.insert([
143+
{
144+
"hex": "#EFDECD",
145+
"name": "Almond",
146+
"rgb": "(239, 222, 205)"
147+
},
148+
{
149+
"hex": "#CD9575",
150+
"name": "Antique Brass",
151+
"rgb": "(205, 149, 117)"
152+
},
153+
{
154+
"hex": "#FDD9B5",
155+
"name": "Apricot",
156+
"rgb": "(253, 217, 181)"
157+
},
158+
{
159+
"hex": "#78DBE2",
160+
"name": "Aquamarine",
161+
"rgb": "(120, 219, 226)"
162+
},
163+
{
164+
"hex": "#87A96B",
165+
"name": "Asparagus",
166+
"rgb": "(135, 169, 107)"
167+
},
168+
{
169+
"hex": "#FFA474",
170+
"name": "Atomic Tangerine",
171+
"rgb": "(255, 164, 116)"
172+
},
173+
{
174+
"hex": "#FAE7B5",
175+
"name": "Banana Mania",
176+
"rgb": "(250, 231, 181)"
177+
}
178+
])
179+
```
180+
[source of crayon json](https://gist.githubusercontent.com/jjdelc/1868136/raw/c9160b1e60bd8c10c03dbd1a61b704a8e977c46b/crayola.json)
181+
182+
```
183+
show collections
184+
```
185+
186+
```
187+
db.crayons.find()
188+
```
189+
190+
```
191+
db.crayons.drop()
192+
```
193+
194+
```
195+
db.dropDatabase()
196+
```
117197

118198
## 05_query

0 commit comments

Comments
 (0)