-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.js
46 lines (35 loc) · 995 Bytes
/
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
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/moedasolidaria');
var db = exports.conn = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
console.log('conectado com sucesso');
});
var taskSchema = mongoose.Schema({
task: String,
price: Number,
desc: String,
ods_num: Number,
ods: String,
p: String,
ngo: String
});
exports.taskModel = mongoose.model('tasks', taskSchema);
var userTaskSchema = mongoose.Schema({
"user_email": String,
"task": String,
"done": Boolean,
"total_currency": Number,
"spent_currency": Number,
"desc": String,
"ods_num": Number,
"ods": String,
"p": String,
"ngo": String
});
exports.userTaskModel = mongoose.model('user_tasks', userTaskSchema);
var productSchema = mongoose.Schema({
"product": String,
"price": Number
});
exports.productModel = mongoose.model('products', productSchema);