-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.js
83 lines (68 loc) · 1.46 KB
/
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
'use strict';
var Docs = require('./models/docs');
var User = require('./models/user');
var user1 = new User({
username: 'gpanag',
email: 'gpanag@test.com',
password: 'password1',
role: 'super_user',
department: 'HR',
created: new Date,
});
user1.save(function(err){
if (err) throw err;
var doc1 = new Docs({
title: 'users 1 doc 1',
text: 'users 1 doc 1 text',
__userDepartment: 'HR'
});
doc1.save(function (err) {
if (err) throw err;
});
});
var user2 = new User({
username: 'amichos',
email: 'amichos@test.com',
password: 'password2',
role: 'simple_user',
department: 'Sales',
created: new Date
});
user2.save(function(err){
if (err) throw err;
var doc1 = new Docs({
title: 'users 2 doc 1',
text: 'users 2 doc 1 text',
__userDepartment: 'Sales'
});
doc1.save(function (err) {
if (err) throw err;
});
var doc2 = new Docs({
title: 'users 2 doc 2',
text: 'users 2 doc 2 text',
__userDepartment: 'Sales'
});
doc2.save(function (err) {
if (err) throw err;
});
});
var user3 = new User({
username: 'giannispan',
email: 'giannispan@test.com',
password: 'password3',
role: 'simple_user',
department: 'Development',
created: new Date
});
user3.save(function(err){
if (err) throw err;
var doc3 = new Docs({
title: 'users 3 doc 1',
text: 'users 3 doc 1 text',
__userDepartment: 'Development'
});
doc3.save(function (err) {
if (err) throw err;
});
});