This repository has been archived by the owner on Oct 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap_db.js
184 lines (178 loc) · 5.65 KB
/
bootstrap_db.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
if (!db.users.findOne()) {
db.users.insert([{
first_name: "ok",
last_name: "ok",
email: "[email protected]",
username: "ok2",
password: "$2a$04$v0hUh4dek2Dho2CQ/jaSze4qjvMG5BQ/UYkChRkTU9Gts7/Tw7MRW",
created_at: ISODate("2013-12-04T21:49:17.871Z"),
role: "author"
}, {
created_at: ISODate("2013-11-30T22:15:33.967Z"),
email: "[email protected]",
first_name: "Nick",
last_name: "Herman",
password: "$2a$04$uRivXHqY9bk7sdgpZrL71.krLLaNaX7qAczNFvPZnN189ZH8VmveC",
username: "ok",
role: "admin"
}]);
var id = db.users.find({username: "ok"})["_id"];
db.userstatuses.insert([{
status: "Hi!",
user: id,
created_at: ISODate("2013-11-15T22:15:33.967Z")
}, {
status: "Anyone?",
user: id,
created_at: ISODate("2013-11-18T12:13:33.927Z")
}, {
status: "Let's blog!",
user: id,
created_at: ISODate("2013-11-28T03:43:13.927Z")
}]);
}
if (!db.articles.findOne()) {
db.articles.insert([{
author: "ok",
body: {data: [{data: {text: "QWERTYUIOP{}"}, type: "text"}]},
comments: [{
author: "ok",
comment: "AAAAAAAAAAAAAAAAAAAA",
comments: [{
author: "ok",
comment: "BBBBBBBBBBBBBBB",
comments: [{
author: "ok",
comment: "CCCCCCCCCCCC",
comments: [{
author: "ok",
comment: "DDDDDDDDDDDDDDDDDDDDDDDDDDD",
created_at: ISODate("2013-12-06T01:36:53.013Z")
}, {
author: "ok2",
comment: "D2D2D2D2D2D2D2D2D2D2D2D2D2",
created_at: ISODate("2013-12-06T15:00:16.148Z")
}],
created_at: ISODate("2013-12-06T00:56:46.103Z")
}],
created_at: ISODate("2013-12-06T00:55:12.750Z")
}],
created_at: ISODate("2013-12-06T00:55:07.417Z")
}, {
author: "ok",
comment: "-------------------------",
comments: [{
author: "ok2",
comment: "+++++++++++++++++++++++",
created_at: ISODate("2013-12-06T14:59:57.591Z")
}],
created_at: ISODate("2013-12-06T01:36:40.333Z")
}],
created_at: ISODate("2013-12-06T00:55:03.210Z"),
preview: "--------------------------",
seo_options: {
author: "Nick Herman <[email protected]>",
description: "--------------------------",
keywords: []
},
tags: [],
title: "Asdfghjkl"
}, {
approved: true,
author: "ok2",
body: {data: [
{data: {text : "> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
cite : "AAAAAAAAAAAAAAAAA"},
type: "quote"}
]},
comments: [{
author: "ok2",
comment: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
comments: [{
author: "ok2",
comment: "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
created_at: ISODate("2013-12-06T15:05:38.223Z")
}],
created_at: ISODate("2013-12-06T15:05:33.171Z")
}],
created_at: ISODate("2013-12-06T15:05:18.955Z"),
preview: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
seo_options: {
author: "Nick Herman <[email protected]>",
description: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
keywords: ["animals", "art", "asia"]
},
tags: ["animals", "art", "asia"],
title: "AAAAAAAAAAAAA"
}, {
approved: true,
author: "ok",
body: {data: [
{data: {file: {large: {url: "/uploads/31201-1n8se41.png"},
url: "/uploads/31201-1n8se41.png"}},
type: "image"
}
]},
comments: [],
created_at: ISODate("2013-12-07T00:26:17.164Z"),
preview: "asdfasdfasdfasdfasd",
seo_options: {
author: "Nick Herman <[email protected]>",
description: "asdfasdfasdfasdfasd",
keywords: ["architecture", "art", "asia"]
},
tags: ["architecture", "art", "asia"],
title: "a"
}]);
}
if (!db.keywords.findOne()) {
"animals architecture art asia australia autumn bike birds birthday canada car cat china christmas church city clouds concert dog england europe family fashion festival film flowers food football france fun garden germany halloween hawaii holiday house india island italy japan kids lake landscape love mexico museum music nature night ocean party people photo river sea sky snow spain spring summer sun taiwan thailand travel usa vacation winter".split(' ').forEach(function(k){ db.keywords.save({_id: k}); });
}
if (!db.categories.findOne()) {
db.categories.insert([{
clear_url: "it",
name: "Computers",
description: "Computer/Internet security, security articles category.",
seo_options: {
author: "Nick Herman <[email protected]>",
description: "Computer/Internet security, security articles category.",
keywords: ["usa", "taiwan", "china", "canada"]
}
}, {
clear_url: "animals",
name: "Animals",
description: "Animals articles category.",
seo_options: {
author: "Nick Herman <[email protected]>",
description: "Animals articles category.",
keywords: ["animals", "cat", "dog", "food"]
}
}]);
}
if (!db.groups.findOne()) {
db.groups.insert([{
cleat_url: 'it',
description: 'IT bloggers group',
seo_options: {
author: "Nick Herman <[email protected]>",
description: "Computer/Internet security, security articles group.",
keywords: ["usa", "taiwan", "china", "canada"]
},
title: 'IT'
}]);
var id = db.groups.findOne()['_id'];
db.users.update({}, {$addToSet: {groups: id}}, {multi: true});
db.groupcomments.insert([{
comment: {
author: "ok",
comment: "-------------------------",
comments: [{
author: "ok2",
comment: "+++++++++++++++++++++++",
created_at: ISODate("2013-12-06T14:59:57.591Z")
}],
created_at: ISODate("2013-12-06T01:36:40.333Z")
},
group: id
}]);
}