File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ var mongoose = require ( 'mongoose' ) ;
2
+
3
+
4
+ var db = mongoose . connection
5
+ var siteInfoSchema = new mongoose . Schema ( { visitors : Number , type : String } , { strict : false } ) ;
6
+
7
+
8
+ // db.once('open', function() {
9
+ // console.log("Connection Successful!");
10
+
11
+ // // define Schema
12
+ // var siteInfoSchema = new mongoose.Schema({visitors: Number, type: String}, { strict: false });
13
+ // // compile schema to model
14
+ // var siteInfo = mongoose.model('siteInfo', siteInfoSchema, 'siteInfo');
15
+
16
+ // // a document instance
17
+ // var siteInfo1 = new siteInfo({ visitors: 0, type: 'visitor_count' });
18
+
19
+ // // save model to database
20
+ // siteInfo1.save(function (err, siteinfo) {
21
+ // if (err) return console.error(err);
22
+ // });
23
+
24
+ // });
25
+
26
+ module . exports = mongoose . model ( 'SiteInfo' , siteInfoSchema ) ;
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ const router = express.Router();
4
4
const fs = require ( "fs" ) ;
5
5
const helper = require ( "../routes/helpers/helpers" ) ;
6
6
const DataLibrary = require ( "../models/datalibrary" ) ;
7
+ const SiteInfo = require ( "../models/siteinfo" ) ;
7
8
8
9
router . get ( "/:type/:uniquestudyid" , function ( req , res , next ) {
10
+ // SiteInfo.findOneAndUpdate({type :'visitor_count'}, {$inc : {'visitors' : 1}}).exec();
9
11
var home = "lab_exp" ;
10
12
if ( process . env . NODE_ENV == "production" ) {
11
13
home = "app" ;
You can’t perform that action at this time.
0 commit comments