-
Notifications
You must be signed in to change notification settings - Fork 0
/
db-playground.mongodb
70 lines (61 loc) · 2.08 KB
/
db-playground.mongodb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// MongoDB Playground
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
const database = 'ecommerce';
const collection = 'articles';
// Create a new database.
use(database);
// Create a new collection.
//db.createCollection(collection);
db.articles.insertOne({
"id": 1,
"brand": "SNEAKER COMPANY",
"title": "Fall Limited Edition Sneakers",
"description": "These low-profile sneakers are your perfect casual wear companion. Featuring a durable rubber outer sole, they’ll withstand everything the weather can offer.",
"price": 100.00,
"originalPrice": 300.00,
"images": [
{
"imageURL": "img/image-product-1.jpg",
"thumbnail": "img/image-product-1-thumbnail.jpg"
},
{
"imageURL": "img/image-product-2.jpg",
"thumbnail": "img/image-product-2-thumbnail.jpg"
},
{
"imageURL": "img/image-product-3.jpg",
"thumbnail": "img/image-product-3-thumbnail.jpg"
},
{
"imageURL": "img/image-product-4.jpg",
"thumbnail": "img/image-product-4-thumbnail.jpg"
}
]
})
// The prototype form to create a collection:
/* db.createCollection( <name>,
{
capped: <boolean>,
autoIndexId: <boolean>,
size: <number>,
max: <number>,
storageEngine: <document>,
validator: <document>,
validationLevel: <string>,
validationAction: <string>,
indexOptionDefaults: <document>,
viewOn: <string>,
pipeline: <pipeline>,
collation: <document>,
writeConcern: <document>,
timeseries: { // Added in MongoDB 5.0
timeField: <string>, // required for time series collections
metaField: <string>,
granularity: <string>
},
expireAfterSeconds: <number>,
clusteredIndex: <document>, // Added in MongoDB 5.3
}
)*/
// More information on the `createCollection` command can be found at:
// https://www.mongodb.com/docs/manual/reference/method/db.createCollection/