Skip to content

Instantly share code, notes, and snippets.

View scotthernandez's full-sized avatar

Scott Hernandez scotthernandez

View GitHub Profile
> db.dates.save({date: new Date("july 3, 1955")})
> db.dates.find()
{ "_id" : ObjectId("4bee29e7751e0000000070cb"), "date" : "Tue Jan -2147483647 584556005 13:25:52 GMT-0800 (Pacific Standard Time)" }
> db.oder.save({x:1})
> db.oder.save({x:3})
> db.oder.save({x:2})
> db.oder.find({x:{$in:[1,2,3]}})
{ "_id" : ObjectId("4c029a9ec94d0000000077c5"), "x" : 1 }
{ "_id" : ObjectId("4c029aa0c94d0000000077c6"), "x" : 3 }
{ "_id" : ObjectId("4c029aa2c94d0000000077c7"), "x" : 2 }
> db.oder.ensureIndex({x:1})
//1.5.4
> db.test2.insert({
... name : "Something",
... things : [
... {foo : "148091a0719c", bar: 1},
... {foo : "0026080741c6", bar: 0}
... ]
... })
> db.test2.update({name:"Something","things.foo":"148091a0719c"}, {$set:{"things.bar":2}})
can't append to array using string field name [bar]
insert/s query/s update/s delete/s getmore/s command/s mapped vsize res % locked % idx miss conn time
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:40
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:41
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:42
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:43
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:44
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:45
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:46
0 0 0 0 0 1 2207 2262 19 0 0 2 07:55:47
0 0 0
insert/s query/s update/s delete/s getmore/s command/s flushes/s mapped vsize res faults/s locked % idx miss % q t|r|w conn time
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:30
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:31
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:32
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:33
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:34
0 0 0 0 0 1 0 0 90 4 0 0 0 0|0|0 1 07:59:35
0 0 0 0 0
> db.serverStatus()
Tue Aug 03 19:57:08 trying reconnect to 127.0.0.1
Tue Aug 03 19:57:08 reconnect 127.0.0.1 ok
{
"version" : "1.4.3",
"uptime" : 4,
"localTime" : "Tue Aug 03 2010 19:57:08 GMT-0700 (Pacific Daylight Time)",
"globalLock" : {
"totalTime" : 4264244,
"lockTime" : 6001,
insert/s query/s update/s delete/s getmore/s command/s mapped vsize res % locked % idx miss conn time
0 0 0 0 0 1 0 53 4 0 0 2 19:59:08
0 0 0 0 0 1 0 53 4 0 0 2 19:59:09
0 0 0 0 0 1 0 53 4 0 0 2 19:59:10
0 0 0 0 0 1 0 53 4 0 0 2 19:59:11
0 0 0 0 0 1 0 53 4 0 0 2 19:59:12
0 0 0 0 0 1 0 53 4 0 0 2 19:59:13
0 0 0 0 0 1 0 53 4 0 0 2 19:59:14
0 0 0 0 0 1 0 53 4 0 0 2 19:59:15
0 0 0
> db.test7.insert({firstName: 'testme',lastName: 'testme', devices: [{address: '[email protected]', type: 'EMAIL'}]})
> db.test7.ensureIndex({'devices.address': 1, 'devices.type': 1})
> db.test7.find({devices: { $elemMatch: {address: /^testme/, type: 'EMAIL'}}}).explain()
{
"cursor" : "BtreeCursor devices.address_1_devices.type_1 multi",
"nscanned" : 1,
"nscannedObjects" : 1,
"n" : 1,
"millis" : 1,
"indexBounds" : {
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) radix(10) lradix(10)
// Source File Name: SaleItem.java
package gen;
import java.io.Serializable;
import java.util.*;
import org.apache.thrift.*;
(2:47:30 PM) skot: Infin1ty: I just did a test on my ubuntu machine and it seems like it takes min(--maxCons, .8*`ulimit -n`) for max connections.
(2:47:51 PM) ajsharp_zz is now known as ajsharp
(2:48:06 PM) Infin1ty: skot, it is, but why does it ignore the mongodb limits in limits.conf? it only works if i set to * or root
(2:48:22 PM) Infin1ty: skot issuing su - -s /bin/bash -c "ulimit -a" mongodb ,shows the correct ulimit
(2:48:50 PM) Infin1ty: skot, looks like the way the init script invoking mongod, so it actually making you set a global ulimit or just for root, which not everyone will like to