start new:
tmux
start new with session name:
tmux new -s myname
| app.use(function (req, res, next) { | |
| res.setHeader('Access-Control-Allow-Origin', '*'); | |
| next(); | |
| }); |
| $ mongostat | |
| insert query update delete getmore command flushes mapped vsize res faults idx miss % qr|qw ar|aw netIn netOut conn time | |
| 2631 *0 *0 *0 0 1|0 0 2.1G 6.7G 1.1G 134 0 0|0 0|0 432k 158k 2 22:59:47 | |
| 2579 *0 *0 *0 0 1|0 0 2.1G 6.7G 1.1G 133 0 0|0 0|0 425k 155k 2 22:59:48 | |
| 2279 *0 *0 *0 0 1|0 0 2.1G 6.7G 1.1G 118 0 0|0 0|0 375k 138k 2 22:59:49 | |
| 2628 *0 *0 *0 0 1|0 0 2.1G 6.7G 1.1G 138 0 0|0 0|0 433k 157k 2 22:59:50 |
| > db.tests.stats() | |
| { | |
| "ns" : "test.tests", | |
| "count" : 1250000, | |
| "size" : 140000000, | |
| "avgObjSize" : 112, | |
| "numExtents" : 12, | |
| "storageSize" : 174735360, | |
| "lastExtentSize" : 50798592, | |
| "paddingFactor" : 1, |
| // Criação do índice em Foreground | |
| > db.tests.createIndex({a:1}); | |
| // Criação em Background | |
| > db.tests.createIndex({a:1}, {background:true}); |
| $ mongotop 3 | |
| ns total read write 2015-04-10T18:00:42-03:00 | |
| test.tests 196ms 0ms 196ms | |
| admin.system.roles 0ms 0ms 0ms | |
| admin.system.version 0ms 0ms 0ms |
| db.system.profile.find({millis:{$gt:500}}).sort({ts:-1}) |
| $ mongod --profile 1 --slowms 2 |
| > db.tests.explain().find({a:1}); | |
| { | |
| "queryPlanner" : { // Informações do Explain | |
| "plannerVersion" : 1, | |
| "namespace" : "tests.tests", | |
| "indexFilterSet" : false, | |
| "parsedQuery" : { | |
| "a" : { | |
| "$eq" : 1 | |
| } |
| > db.tests.createIndex({a:1, b:1}); //A criação de indice pode ser simples ou composta | |
| { | |
| "createdCollectionAutomatically" : false, | |
| "numIndexesBefore" : 1, | |
| "numIndexesAfter" : 2, | |
| "ok" : 1 | |
| } | |
| > db.tests.createIndex({a:-1}); //Ao passar o parametro negativo o índice é para ordem decrescente | |
| { | |
| "createdCollectionAutomatically" : false, |