This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// models/Post.js mongoose schema for mongoDB | |
// I'd like this method to take in param1 and param2 | |
PostSchema.methods.thisMethod = function(cb) { | |
this.upvotes += 1; | |
this.save(cb); | |
}; | |
// Now we create the route in our index.js: | |
router.put('/posts/:post/upvote', function(req, res, next) { | |
var param1 = "hi"; | |
var param2 = 33; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// models/Post.js mongoose schema for mongoDB | |
PostSchema.methods.upvote = function(cb) { | |
this.upvotes += 1; | |
this.save(cb); | |
}; | |
// Now we create the route in our index.js: | |
router.put('/posts/:post/upvote', function(req, res, next) { | |
req.post.upvote(function(err, post){ | |
if (err) { return next(err); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:~/meeth-app$ mongo | |
MongoDB shell version: 2.6.11 | |
connecting to: test | |
> ^C | |
bye | |
melissa@simba:~/meeth-app$ npm start | |
> meeth-app@0.0.0 start /home/melissa/meeth-app | |
> node ./bin/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:/var/lib$ tail -100 /var/log/mongodb/mongod.log | |
2015-09-24T19:27:44.705+0000 [initandlisten] recover : no journal files present, no recovery needed | |
2015-09-24T19:27:44.705+0000 [initandlisten] | |
2015-09-24T19:27:44.705+0000 [initandlisten] ERROR: Insufficient free space for journal files | |
2015-09-24T19:27:44.705+0000 [initandlisten] Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles | |
2015-09-24T19:27:44.705+0000 [initandlisten] | |
2015-09-24T19:27:44.705+0000 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating | |
2015-09-24T19:27:44.705+0000 [initandlisten] dbexit: | |
2015-09-24T19:27:44.705+0000 [initandlisten] shutdown: going to close listening sockets... | |
2015-09-24T19:27:44.705+0000 [initandlisten] shutdown: going to flush diaglog... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:/$ cat /etc/mongod.conf | |
# mongod.conf | |
# Where to store the data. | |
# Note: if you run mongodb as a non-root user (recommended) you may | |
# need to create and set permissions for this directory manually, | |
# e.g., if the parent directory isn't mutable by the mongodb user. | |
dbpath=/var/lib/mongodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:/$ sudo chown -R mongodb /data | |
melissa@simba:/$ ls -alt /data | |
total 12 | |
drwxr-xr-x 3 mongodb root 4096 2015-09-24 19:14 db | |
drwxr-xr-x 23 root root 4096 2015-09-15 00:47 .. | |
drwxr-xr-x 3 mongodb root 4096 2013-01-31 07:45 . | |
melissa@simba:/$ mongo | |
MongoDB shell version: 2.6.11 | |
connecting to: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:/$ sudo chmod -R /data mongodb | |
chmod: invalid mode: `/data' | |
Try `chmod --help' for more information. | |
melissa@simba:/$ cd /data/ | |
melissa@simba:/data$ ls -alt | |
total 12 | |
drwxr-xr-x 3 melissa root 4096 2015-09-24 19:14 db | |
drwxr-xr-x 23 root root 4096 2015-09-15 00:47 .. | |
drwxr-xr-x 3 root root 4096 2013-01-31 07:45 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melissa@simba:~/meeth-app$ cat /etc/init.d/mongod | |
#!/bin/sh -e | |
# upstart-job | |
# | |
# Symlink target for initscripts that have been converted to Upstart. | |
set -e | |
INITSCRIPT="$(basename "$0")" | |
JOB="${INITSCRIPT%.sh}" |
NewerOlder