This is the 16th in series of posts leading up Node.js Knockout, and covers provisioning MongoLab for use in your node app.
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
// make sure we're using the right db; this is the same as "use aggdb;" in shell | |
db = db.getSiblingDB("aggdb"); | |
// simple projection | |
var p1 = db.runCommand( | |
{ aggregate : "article", pipeline : [ | |
{ $project : { | |
tags : 1, | |
pageViews : 1 | |
}} |
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
var mongo = require('mongodb'); | |
var mongoUri = 'mongodb://localhost:27017/mongoquest'; | |
mongo.Db.connect(mongoUri, function (err, db) { | |
/* adventure! */ | |
}); |
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
db.collection('quests', function(er, cl) { | |
cl.insert({'goal': 'Explore', 'lv': 1}, {safe: true}, function(er,rs) { | |
cl.update({'goal': 'Explore'}, | |
{'$set': {'gold': 150}}, {safe: true}, function(er,rs) { | |
cl.find({'lv': {'$lte': 4}}).toArray(function (er,rs) { | |
console.log(rs); | |
}); }); }); }); |
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
mfind -t o -n JPG /$MANTA_USER/stor/pictures | mjob create -w -m 'convert -quality 50 -define webp:lossless=true $MANTA_INPUT_FILE /var/tmp/out.webp && mpipe ${MANTA_INPUT_OBJECT%.*}.webp < /var/tmp/out.webp' |
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
mfind -t o -n JPG /$MANTA_USER/stor/pictures | mjob create -w -m 'convert -quality 50 -define webp:lossless=true $MANTA_INPUT_FILE /var/tmp/out.webp && mpipe ${MANTA_INPUT_OBJECT%.*}.webp < /var/tmp/out.webp' |
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
{ | |
"phases": [ | |
{ | |
"type": "map", | |
"assets": ["/manta/public/kartlytics/bin/video-metadata"], | |
"exec": "/assets/manta/public/kartlytics/bin/video-metadata /$MANTA_USER/public $MANTA_INPUT_FILE" | |
}, | |
{ | |
"type": "reduce", | |
"exec": "json -g | mpipe /$MANTA_USER/public/kartlytics-summary.json" |
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
Param ( | |
[alias("nl")] | |
[switch] | |
$NoLinks, | |
[alias("v")] | |
[switch] | |
$Verbose, | |
[alias("q")] | |
[switch] | |
$Quiet, |
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
https://share.icloud.com/photos/0w3YqvOVSuD_GWubI9k65WnoA |