Skip to content

Instantly share code, notes, and snippets.

View scotthernandez's full-sized avatar

Scott Hernandez scotthernandez

View GitHub Profile
> db.test0.find({v:{$all:[1,2]}})
{ "_id" : 2, "v" : [ 1, 2, 3 ] }
> db.test0.find({v:{$all:[1,2]}}).explain()
{
"cursor" : "BasicCursor",
"nscanned" : 3,
"nscannedObjects" : 3,
"n" : 1,
"millis" : 37,
"nYields" : 0,
0 0 0 0 0 1 0 9597 9671 44 0 0 0|0|0 2 16:17:30
0 0 0 0 0 1 0 9597 9671 44 0 0 0|0|0 2 16:17:31
0 0 0 0 0 2 0 9517 9592 28 0.9 0 0|0|0 3 16:17:32
6 14 15 4 0 47 0 9517 9606 29 41 0 0|0|0 17 16:17:33
8 11 19 8 0 68 0 9597 9699 45 44.7 0 0|0|0 30 16:17:34
16 20 5 0 0 42 0 9517 9655 29 65.1 0 0|0|0 50 16:17:35
4 35 44 1 0 67 0 9533 9672 38 60.6 0 0|0|0 67 16:17:36
insert/s query/s update/s delete/s getmore/s command/s flushes/s mapped vsize res
> a = [1]; a[4] = a[4] ? 1 : a[4] + 1;
NaN
> a
[ 1, undefined, undefined, undefined, NaN ]
db.social_users.find({login:'tanvlm'},{posts:0, scores:0,friends:0,followers:0,from_terms:0});
{ "#mongodb_today_score" : 0, "#rails_today_score" : 0, "MAKE_today_score" : 0.25, "id" : "4c65fece448751651801b251", "type" : "TwitterUser", "a-rod_today_score" : 0, "android_today_score" : 0, "apple_today_score" : 0.25, "bieber_today_score" : 0, "braves_today_score" : 0, "categories" : [ ], "celtics_today_score" : 0, "created_at" : "Fri Aug 13 2010 17:00:00 GMT-0700 (PDT)", "description" : null, "dodocase_today_score" : 0, "eminem_today_score" : 0, "favre_today_score" : 0, "followers_count" : 173, "foursquare_today_score" : 0, "friends_count" : 1, "gaga_today_score" : 0, "inception_today_score" : 0, "iphone_today_score" : 0, "is_protected" : false, "jetsetter_today_score" : 0, "katy_today_score" : 0, "lakers_today_score" : 0, "last_post" : "Mon Sep 13 2010 16:00:46 GMT-0700 (PDT)", "login" : "tanvlm", "made_at" : "Fri Nov 20 2009 06:19:48 GMT-0800 (PST)", "mom_today_score" : 0, "name" : "Tanveer Kkan", "num_tweets
(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
// 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.*;
> 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" : {
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.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 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