-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoticeModel.js
53 lines (48 loc) · 1.41 KB
/
noticeModel.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
module.exports = function (moneo, mongoose) {
// declaration for mongoose Schema
var Schema = mongoose.Schema;
// notice schema
var NoticeSchema = new Schema({
title: {
type: String,
// setting the nodeProperty to true; will save this schema property in neo4j graph db
nodeProperty: true,
default: ''
},
caption: {
type: String,
// setting the nodeProperty to true; will save this schema property in neo4j graph db
nodeProperty: true,
default: ''
},
image: {
type: String,
// setting the nodeProperty to true; will save this schema property in neo4j graph db
nodeProperty: true,
default: ''
},
data: {
type: Date,
// setting the nodeProperty to true; will save this schema property in neo4j graph db
nodeProperty: true,
default: Date.now
},
active: {
type: Boolean,
// setting the nodeProperty to true; will save this schema property in neo4j graph db
nodeProperty: true,
default: true
}
});
// pushing the data into neo4j graph db
NoticeSchema.plugin(moneo);
// declaration of mongoose data model
var noticemodel = mongoose.model('Notice', NoticeSchema);
// running a cypherQuery for the data model
// this query will fetch all the nodes and return all the nodes.
noticemodel.cypherQuery({ query: 'match (n) return n' }, function (err, res) {
console.log("Result of notice model " + res);
});
// data model is returned
return noticemodel;
}