PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 6th of June, 2012

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:38:12] <multi_io> could it be that spring-data identifies the properties in its @Documents via the defined fields, rather than using beans/BeanInspector???
[01:19:47] <jonwage> anyone ever gotten this error when connecting to mongod from php?
[01:19:48] <jonwage> [MongoConnectionException]
[01:19:49] <jonwage> couldn't get host info for localhost
[01:20:14] <jonwage> tried some of the things here http://stackoverflow.com/questions/5425089/mongodb-giving-weird-connection-error
[01:20:15] <jonwage> and here
[01:20:16] <jonwage> http://stackoverflow.com/questions/4961177/how-to-listen-only-to-localhost-on-mongodb
[01:20:42] <jonwage> I'm connecting using localhost
[01:28:13] <dstorrs> jonwage: you mean you're connecting to a server that is running on localhost?
[01:28:26] <jonwage> it's all on a local laptop
[01:28:27] <jonwage> osx
[01:28:38] <jonwage> vanially mongodb, freshly unpacked just running with no options
[01:28:40] <dstorrs> and you're sure that mongod is running?
[01:28:44] <jonwage> yup
[01:28:47] <jonwage> i can mongo testdb
[01:28:52] <dstorrs> huh
[01:29:00] <jonwage> db.users.insert({"username":"test"})
[01:29:03] <dstorrs> what driver ?
[01:29:03] <jonwage> db.users.find().pretty()
[01:29:06] <jonwage> from php
[01:29:39] <dstorrs> did you try this? : http://php.net/manual/en/class.mongoconnectionexception.php
[01:29:50] <dstorrs> maybe you need to specify the host / post / etc
[01:30:54] <jonwage> ok, it's gotta be something related to that. we have a default configuration for our app that works with most local dev environments but for some reason its not working on this new laptop running osx
[01:31:14] <jonwage> thanks for the help
[01:31:21] <dstorrs> no worries
[04:07:45] <drollwit> either i'm clueless or mongodb install documentation is unclear
[04:08:10] <drollwit> i follow along, make sure i've got homebrew working smoothly and then type in 'mongod' and get this
[04:08:18] <drollwit> http://pastie.org/4035688
[04:08:31] <drollwit> there is a minute hang time between the last and second to last lines
[04:08:44] <drollwit> then a flashing cursor that ... does nothing.
[04:09:10] <drollwit> web searching doesn't indicate a fix (on a macbook pro osx lion)
[04:09:17] <dstorrs> drollwit: looks fine to me. You've got a server running.
[04:09:29] <dstorrs> in another window you can start a client to connect to it. what were you expecting?
[04:10:44] <dstorrs> open another terminal and type 'mongo'
[04:10:49] <drollwit> got it
[04:11:04] <drollwit> documentation says: Then open the mongo shell by issuing the following command at the system prompt: mongo
[04:11:20] <drollwit> and yep that opens test
[04:11:33] <dstorrs> there you go
[04:11:39] <drollwit> i did not get from that line to open another window (duh)
[04:11:48] <dstorrs> heh. BTDT
[04:12:11] <drollwit> thanks
[04:12:14] <dstorrs> np
[04:12:39] <drollwit> i'll go away now and see if i can get a bit further than that ;)
[04:12:39] <dstorrs> on the 'facepalm error' front...
[04:13:03] <dstorrs> for the last few hours, I've been wondering why the hell my tests were only storing 1 record instead of 5
[04:13:35] <dstorrs> I thought "oh, must be an index causing this to be an update instead of an insert"
[04:13:44] <dstorrs> but there weren't any...
[04:14:05] <dstorrs> ...except for, you know, the *default* one on the _id column that every collection has
[04:14:21] <dstorrs> and that I had just spent an hour very carefully populating.
[05:13:41] <leku> this might not be the best place, but I'm having trouble adding the mongohq:free addon to my heroku project
[05:13:46] <tomlikestorock> anyone know how to do a findandmodify from within mongoengine?
[05:13:46] <leku> keeps saying app not found
[05:22:36] <rubynoob2> hi.. for the first time I am using mongodb to store json results from a webservice to my local mongodb database.. i finally got it working.. and it has exceeded my expectations.. the speed of mongodb is unbelieveably fast its just mind blowing..
[05:22:56] <rubynoob2> I am so excited.. i have no one to share this with because my friends are sql fans...
[05:23:06] <rubynoob2> so i share this with you strangers in this channel.. i'm shaking..
[05:23:42] <rubynoob2> shaking with disbelief how how fast mongodb is... i mean.. its so fast.... do I need to bother with adding memcached to my stack if mongodb is so god dam fast??
[05:47:43] <henrykim> is it good idea to use sha1 hash key as a shard key?
[05:48:04] <jwilliams_> it 's recommended that shard key is uniqie.
[06:25:07] <henrykim> How much Balancer's jobs do affect a performance of mongodb?
[06:25:39] <henrykim> for example, I have currently 2 shards which are having 320 chunks in each.
[06:25:53] <henrykim> and then I setup new shard additionally.
[06:26:24] <henrykim> how can I guess this rebalancing jobs are done?
[06:27:00] <henrykim> how can I guess this balancing jobs do affect a performance of mongodb?
[06:27:58] <wereHamster> henrykim: don't guess. Test and benchmark yourself
[06:27:58] <dstorrs> henrykim: no idea, but let me know when you find the answer. I'm getting into the same boat very soon
[06:31:20] <henrykim> in a router server, mongos print out ChunkManager's log like "Wed Jun 6 15:27:39 [WriteBackListener-search-ddm-test4.daum.net:27018] ChunkManager: time to load chunks for blog.article: 25ms sequenceNumber: 405 version: 128|1"
[06:32:07] <henrykim> yes, ChunkManager controls Balancer's job internally.
[06:32:26] <henrykim> it has sequenceNumber and version of it.
[06:33:34] <henrykim> sequenceNumber is increased number, I guess this is the clue of ChunkManager splits a single chunk (64MB) and then move it to a destination.
[06:33:50] <henrykim> it does copy and then delete.
[07:02:02] <mbuf> is there a recommended way to ensure that no duplicate inserts happen in a mongo database for a compound index?
[07:02:07] <mbuf> or an index
[07:05:20] <NodeX> you can add dropDups and unique
[07:06:33] <dstorrs> mbuf: db.coll.ensure_index({ foo : 1, bar : -1}, { unique : true})
[07:06:41] <dstorrs> et voila
[07:06:51] <mbuf> dstorrs: thanks!
[07:06:55] <dstorrs> np.
[07:07:14] <dstorrs> actually, I mixed languages there. In the shell it's "ensureIndex(...)"
[07:09:15] <NodeX> if you want it to drop the duplicates just add dropDups : true
[07:09:25] <NodeX> (after the unique)
[07:09:27] <mbuf> dstorrs: is there something that needs to be imported to use true?
[07:09:52] <dstorrs> mbuf: driver or shell?
[07:10:13] <mbuf> dstorrs: I am using it in python; have from pymongo import Connection, ASCENDING
[07:10:32] <mbuf> dstorrs: I get NameError: global name 'true' is not defined
[07:10:44] <dstorrs> from the driver you just need a true value
[07:10:58] <dstorrs> the value <true> is a JavaScript boolean
[07:32:01] <[AD]Turbo> hola a todos
[07:32:30] <dstorrs> [AD]Turbo: bunos tardes
[08:16:15] <eloy_> Hi, One question about Mongodb-php driver
[08:16:46] <eloy_> When I use query with $gte and $lte in debian host don't run
[08:18:16] <eloy_> But, If I use Ubuntu host work fine. I update (In debian host) to php 5.3.13 and compile last revision of php-mongo from github but don't run ok
[08:18:37] <eloy_> Any problem with debian hosts?
[08:34:10] <bjori> eloy_: never heard of such problem. works fine for me on several debian servers
[08:34:39] <eloy_> and use mongo drive 1.2.10?
[08:35:38] <bjori> alnewkirk: yes
[08:36:37] <bjori> what. that was supposed to be eloy_ ^^
[08:39:21] <eloy_> and 5.3.3-7+squeeze8 ?
[08:50:54] <NodeX> eloy : can you be a little more specific
[08:55:40] <eloy_> I'm preparing a pastebin with all doc
[08:58:29] <NodeX> tn
[08:58:30] <NodeX> x
[09:24:07] <eloy_> http://pastebin.com/0gyf9xYA
[09:24:20] <eloy_> I put a lot information in this pastebing
[09:26:03] <NodeX> does it work from the shell?
[09:27:39] <eloy_> yes
[09:27:44] <eloy_> from shell run ok
[09:29:06] <NodeX> the same data in both ?
[09:29:28] <eloy_> yes, same database
[09:29:48] <eloy_> the same script
[09:31:09] <NodeX> the only thing I can think of is the query is not running due to memory/index problems
[09:33:23] <jwilliams_> I encounter the issue 176 (http://code.google.com/p/morphia/issues/detail?id=176) is there any way to solution for that? After reading the issue, i do not see a solution provided.
[09:37:41] <eloy_> Any solution? Why their work in ubuntu host?
[09:38:37] <NodeX> more free ram maybe - I don't know - it's just a guess
[09:42:14] <bjori> eloy_: is it the same mongodb server, and two different php frontends?
[09:43:17] <eloy_> yes
[09:44:14] <bjori> eloy_: could you paste the output of php --ri mongo
[09:45:36] <bjori> eloy_: eloy_ and php -r 'var_dump(PHP_INT_MAX);'
[09:46:17] <bjori> I think your debian server may be a 32bit platform :]
[09:46:20] <eloy_> http://pastebin.com/XLerbALh
[09:47:14] <eloy_> php -r 'var_dump(PHP_INT_MAX);'
[09:47:14] <eloy_> int(9223372036854775807)
[09:47:56] <yawniek> my slave constantly has delays between 20m and 2h, io wait about 10%, mongodb 2.0.4. what should i check to figure out why this happens?
[09:48:10] <eloy_> Ubuntu is 32 bits, debian are 64 bits platform
[09:50:40] <bjori> eloy_: that integer in your code is 64bit integer, not 32. so on your 32bit platform it will be totally different number
[09:51:01] <bjori> eloy_: do for example php -r 'var_dump(1338969265000);'
[09:51:43] <eloy_> php -r 'var_dump(1338969265000);'
[09:51:43] <eloy_> int(1338969265000)
[09:52:47] <bjori> eloy_: you probably then saved the value on the 32bit platform
[09:52:50] <bjori> eloy_: http://derickrethans.nl/64bit-ints-in-mongodb.html
[09:55:18] <eloy_> let me check
[10:02:25] <eloy_> Ok, this is the solution
[10:02:30] <eloy_> many thanks
[10:16:45] <bjori> eloy_: anytime :)
[10:17:35] <NodeX> ah, I forgot about 32bit systems and the ints lol
[10:21:54] <eloy_> no problem, now I have a machine with 8 GB Ram :)
[10:24:21] <NodeX> I used a different approach than the one recommended by Derick because his method didn't work for me
[10:27:51] <eloy_> no problem, all help are good for a problem, I 'm lazy with this problem, many hours checking dependencies, php code, etc..
[10:31:19] <NodeX> heh
[10:48:19] <amitprakash> Is it possible to iterate over a cursor object twice? [ pymongo returns a cursor object ]
[10:49:15] <NodeX> copy the cursor in your app?
[11:07:09] <giskard> hello guys,
[11:07:26] <giskard> there is a way to specify safe=false in the config file instead of passing it in the URI
[11:08:22] <giskard> (and or do you know how to pass it using the casbah mongo driver)
[11:13:36] <mongonub> When stroring references/links, should the reference ids be stored as plain text or as ObjectIds? ie. photo_id: '4fcf364919f9bebce2000001' vs photo_id: ObjectId('4fcf364919f9bebce2000001')?
[11:14:38] <algernon> what would be the point of storing them as text?
[11:14:50] <Killerguy> hi guys
[11:14:59] <nicholasdipiazza> hello
[11:15:05] <algernon> it takes more space, and you have to convert it back to OID anyway if you want to look it up.
[11:15:33] <Killerguy> is it possible to do query with $in and $regex combine?
[11:15:43] <mongonub> algernon: ah makes sense.. I forgot that OIDs are 12 bytes long!
[11:15:46] <NodeX> Killerguy : yes but it's slow
[11:16:22] <algernon> mongonub: even if it'd be longer than the string, if you need to convert, it won't be worth it, in most cases
[11:16:38] <Killerguy> db.test.file.findOne({ access : { $in : [ { login : "azerty", "name" : /*/ } ] } })
[11:16:40] <Killerguy> for example?
[11:16:54] <Killerguy> I'm trying but it doesn't works
[11:18:02] <NodeX> check the log - see what went wrong
[11:18:31] <mongonub> Another question: I need to generate non-predictable ids for photos.. is it still possible to make use of ObjectIds or do I have to go plain text based keys?
[11:19:53] <NodeX> you can tell mongo what it's OID's are
[11:20:07] <NodeX> ObjectId("FooBar12345");
[11:26:59] <simenbrekken> Has anyone had success running mongorestore over a SSH tunnel?
[11:27:06] <nicholasdipiazza> I have the document {docId:1, inner:{docId:2, value:'myval'}}. I Tried: db.tmp.find({"inner":{"$elemMatch" : {"value":"val"}} Doesn't work. What am I missing?
[11:27:20] <simenbrekken> I keep getting an authentication failure assertion: 9997 auth failed: { errmsg: "auth fails", ok: 0.0 }
[11:27:45] <nicholasdipiazza> I have the document {docId:1, inner:{docId:2, value:'val'}}. I Tried: db.tmp.find({"inner":{"$elemMatch" : {"value":"val"}} I am searching for all documents with inner.value='val'. Doesn't work. What am I missing?
[11:30:10] <NodeX> err
[11:30:36] <NodeX> db.foo.find({"inner.value":"val"}); ;)
[11:30:42] <nicholasdipiazza> oh i see what i did
[11:30:47] <nicholasdipiazza> doh!
[11:30:48] <nicholasdipiazza> thanks
[11:30:55] <NodeX> s/foo/tmp
[11:32:23] <Killerguy> mongosniff doesn't hhelp NodeX
[11:34:39] <nicholasdipiazza> With Mongo.exe on winders, How can I cancel the query I'm writing and strat fresh without using ctrl+d?
[11:34:52] <nicholasdipiazza> start*
[11:36:17] <mongonub> NodeX: So just that I understand.. I can generate random non-predictable OIDs by generating a 24 character string where each char is [0-9,a-d] and then casting that to ObjectId?
[11:36:43] <mongonub> Given that MongoDB makes some assumptions about ObjectIds, such as their ascending order, can this result in some unexpected behavior such as favoring some photos over others in some queries or something like that?
[11:42:22] <NodeX> it doesn't have to be 24 chars
[11:42:27] <NodeX> it can be anything you like
[11:46:03] <nicholasdipiazza> I have {docID:1, inner : [ {id:2, chunks:[{id:3, subType:'PO'}, {id:4, subType:'AUDIO'}]} ]} and I need to query all chunks with subType Audio. I tried this db.tmp.find({inner:{"$elemMatch":{"chunks":{"$elemMatch":{"subType":"AUDIO"}}}}}) but it just returns the full document. What am I missing?
[11:46:21] <NodeX> why are you doing elemMatch ?
[11:46:39] <nicholasdipiazza> not sure
[11:46:43] <nicholasdipiazza> newb
[11:46:53] <NodeX> db.tmp.find({"inner.subType":"audio"});
[11:47:02] <NodeX> db.tmp.find({"inner.subType":"AUDIO"});
[11:47:13] <NodeX> or ...
[11:47:24] <NodeX> db.tmp.find({"inner.chunks.subType":"AUDIO"});
[11:47:28] <nicholasdipiazza> that was it
[11:47:32] <nicholasdipiazza> you are excellent thank you
[11:47:36] <NodeX> didn't see your second array
[11:47:54] <nicholasdipiazza> i couldn't figure out how to do the multi-dimensionality like that until now
[11:47:59] <nicholasdipiazza> think i get it
[11:48:11] <NodeX> it's dot notation - like json
[11:49:23] <nicholasdipiazza> that still returned just the root document though
[11:49:38] <nicholasdipiazza> so that also included the element with subType PO
[11:50:11] <nicholasdipiazza> there is no way to get a cursor to the actual sub elements?
[11:53:58] <nicholasdipiazza> seems like there should be a way to call find on documents themselves.
[11:59:14] <NodeX> no
[11:59:18] <NodeX> you must slice it
[11:59:54] <nicholasdipiazza> ok checking out the slice operator now
[11:59:57] <NodeX> db.tmp.find({"inner.chunks.subType":"AUDIO"},{chunks:1});
[12:00:06] <nicholasdipiazza> oh
[12:00:42] <edussooriya> hello guys!
[12:01:17] <edussooriya> is there a way to get stats like db.pages.find().explain() in update()
[12:01:19] <nicholasdipiazza> so that returned: { "_id" : ObjectId("4fcf44f5322bc128278bc0f5") }
[12:01:42] <nicholasdipiazza> which is just the ID of the root document
[12:02:26] <mongonub> NodeX: ObjectId("foo") results in "invalid object id: length" ?
[12:04:13] <NodeX> never knew that
[12:04:23] <NodeX> the drivers handle - perhaps pad it out .. not sure
[12:05:36] <nicholasdipiazza> db.tmp.find({"inner.chunks.subType":"AUDIO"},{"inner.chunks":1});
[12:05:38] <mongonub> Also, the performance of ObjectIds probably take a significant hit when they are non-increasing (random)
[12:05:39] <nicholasdipiazza> now i'm rockin!
[12:06:29] <mongonub> Because of how indexing works
[12:07:04] <edussooriya> is there a way to get stats like db.pages.find().explain() in update()
[12:16:30] <nicholasdipiazza> oops nope I'm blind. i'm not rockin. that still returns just the outer document.
[12:16:50] <nicholasdipiazza> does every mongo query just return the root document, even though you are searching for inner documents?
[12:26:10] <amitprakash> Hi, for a given collection with keys a and b, I want to find the counts [ number of rows ] where either a or b = some value x.. However, I want to do this for a list of such values of x, X = [x] , what would be the mongo query for this?
[12:29:50] <nicholasdipiazza> @amitprakash: db.tmp.find({DocID:1234}).limit(1)[0].inner.length; finds the array length of this --> {DocID:1234, inner:[{}, {}, ... ]}
[12:29:53] <nicholasdipiazza> not sure if that helps you
[12:31:11] <amitprakash> nicholasdipiazza, don't really understand that
[12:31:37] <nicholasdipiazza> oh sorry no what you are asking wasn't described by that.
[12:31:42] <nicholasdipiazza> sorry
[12:32:35] <amitprakash> currently I am doing db.collection.count({'$or': [{'a': x}, {'b': x}]}) while iterating over X, but I was wondering if this couldn't be done with a single query
[12:42:01] <mongonub> What is meant by invariancy of ObjectId?
[12:47:46] <multiHYP> hi
[12:56:39] <mongonub> It is mentioned that UUIDs should be stored as BinData.. could anyone show an example on how to can convert SecureRandom.uuid to BinData in Ruby?
[13:21:21] <wereHamster> mongonub: http://api.mongodb.org/ruby/current/BSON/Binary.html
[13:21:28] <wereHamster> SUBTYPE_UUID
[13:24:26] <jwilliams_> is there any way to avoid the issue 176 (http://code.google.com/p/morphia/issues/detail?id=176)?
[13:24:52] <jwilliams_> in the issue it states that the exception is changed to wrarning, but i still get exception thrown.
[13:25:06] <jwilliams_> Caused by: com.google.code.morphia.mapping.MappingException: A type could not be found for private java.lang.Object ...
[13:25:28] <jwilliams_> mongodb driver 2.6.5, morphia 0.99
[13:25:44] <zakdances> Whats the best way to send back the result of a cursor as a JSON object in python (pymongo)?
[13:37:19] <modcure> when firing up mongodb, does it try to store all the dat(files) in memory and whatever doesnt fit store in virtual memory ?
[13:38:54] <NodeX> correct / disk / vram
[13:41:53] <mongonub> wereHamster: BSON::Binary.initialize(SecureRandom.uuid, BSON::Binary::SUBTYPE_UUID) => NoMethodError: private method `initialize' called for BSON::Binary:Class.. not sure how to use that class
[13:43:02] <mongonub> oh wtf, I need to sleep.. initialize => new of course
[13:43:06] <mongonub> T_T
[13:43:43] <skot> modcure: everything is memory mapped by the operating system. What the OS can fit in memory will be and the rest will only be on disk.
[13:44:21] <skot> The OS will flush to the background when mongod asks (every 60s by default) or when you do a safe write w/fsync or via the fsync command
[13:44:35] <skot> http://mongodb.org/display/DOCS/Caching
[13:44:58] <modcure> skot, when mongodb fires up for the first time... VMM will grap the data files and store them in active(physial ram) and whatever doesnt fit place the rest in virtual memory(mapped files) on disk ?
[13:49:03] <modcure> skot, on the mongodb website is says: MongoDB uses memory mapped files for managing and interacting with all data. MongoDB memory maps data files to memory as it accesses documents. Data that isnt accessed is not mapped to memory.
[13:49:25] <modcure> lost
[13:51:43] <mongonub> wereHamster: do you know what the UUID subtype does and if it expects some certain data format (bytes, hex, string) and/or length? documentation on the BSON website is scarse as well :(
[13:57:31] <skot> modcure: no data is lost but only data that is used will be read into memory and the OS will release memory for things not recently used when the memory is needed.
[13:58:38] <skot> mongonub: this might help: https://jira.mongodb.org/browse/JAVA-403
[13:58:49] <hillct> Good morning all. For some reason I can't find the .findOne( notation relating to $oid object ID lookups. Can someone remind me, or point me to the proper doc page? I thought it was db.myCollection.find({_id: {$oid: "myIdBSON-string-here"}})
[13:59:33] <NodeX> "_id":ObjectId("your_id");
[13:59:34] <skot> don't use $oid use ObjectId
[13:59:36] <modcure> skot, this would need i would need double the space for my data. disk and the virtual disk(disk) ?
[13:59:57] <Mmike> why would mongodb listen to two TCP ports? replication, or is that -by design-?
[14:00:05] <skot> modcure: data from the files is never written to the swap file if that is what you mean
[14:00:22] <skot> Mmike, the high port is a web-server
[14:00:41] <Mmike> tcp 0 0 *:27017 *:* LISTEN mongodb 2516 3800/mongod
[14:00:42] <Mmike> tcp 0 0 *:28017 *:* LISTEN mongodb 4476 3800/mongod
[14:00:48] <Mmike> so, 28017 is webserver?
[14:00:50] <ovaillancourt> Mmike: -> http://www.mongodb.org/display/DOCS/Connections
[14:01:02] <skot> def is 27017 for mongodb wire protocol, +1000 for web admin port
[14:01:05] <modcure> skot, virtual memory is a block on hard disk acting as if it were physical memory. to me this would imply double the space for my data. no ?
[14:01:29] <skot> nope, best you should read up on virtual memory and memory mapped files.
[14:01:40] <modcure> i did, still lost. :(
[14:01:49] <wereHamster> mongonub: are you new to ruby? #initialize is called when you do Foo.new
[14:01:53] <modcure> virtual memory is space on disk(what i read last nite)
[14:02:02] <Mmike> skot, thnx!
[14:02:34] <souza> Hi all
[14:02:36] <skot> modcure: on my way out, best you talk to someone about memory in general as this has little to do with mongodb, or search the group linked in the topic here
[14:03:13] <hillct> NodeX: in this form? I get a JS parse error... collectionname.find({ "_id" : ObjectId( "4fcf5ee350b77eee45000001" )})
[14:05:18] <NodeX> remove the spaces and try again
[14:05:42] <NodeX> should work fine .. perhaps the spaces (i dont think so but stranger things have happened
[14:05:48] <souza> Guys, do you know some way to create OID to objects in array, for example i have this structure > http://pastebin.com/Ki1q37f4 but only my user object gets an OID if i run it, getting this > http://pastebin.com/3nY1tz50 i want that all objects in my bson generate an OID
[14:06:12] <NodeX> souza : your app has to do that
[14:09:44] <nicholasdipiazza> Hi guys. Here is a javascript mongo script that will update all members of an array. http://pastebin.com/mVEkzbC3 Is there no way to do this with one query instead of using a loop?
[14:09:45] <masone> Hey all. My mongo has a high page faults rate (100/s). The data is about three times the ram but the ram does not seem to get fully used. What's the correct way to determine the real working set size / real memory usage?
[14:12:31] <hillct> NodeX: my issue seems to relate to a modiication made to my queries when run through the mongoHub Mac Mongo client tool, so not a DB problem...
[14:13:42] <souza> NodeX: I'm trying it by mongo shell
[14:13:54] <souza> NodeX: Only for tests.
[14:21:52] <NodeX> hillct : oki doki
[14:22:02] <NodeX> mac's suck - true story - no lie!
[14:22:22] <NodeX> souza : try ... new ObjectId()
[14:22:23] <hillct> NodeX: Not a BSD fan?
[14:23:30] <NodeX> not an overpriced pretentious hardware fan tbh
[14:24:25] <NodeX> I'm just trolling coz i'm bored
[14:30:34] <souza> NodeX: I've created vars with OID inside and inform it object instantiation.
[14:32:35] <NodeX> dunno what that means but kudos ;)
[15:12:36] <senior7515> i see that 2.2 was release http://www.mongodb.org/display/DOCS/2.2+Release+Notes how to download the stable branch of 2.1 which I assume would be 2.2
[15:13:29] <kali> senior7515: stable is still 2.0.6, you're propably looking at a work in progress document
[15:19:28] <senior7515> kali: got you… hmmm i think I have a problem with the aggregation framework… it like process about 3/4 ths of the docs and then stops. I'm making the db operation with a write concern of SAFE… trying to track it down… any tips. I'm going to do some lastError check see if that returns something
[15:20:59] <kali> senior7515: i have absolutely no experience with the aggregation fw. let's hope somebody else around here can help you.
[15:24:02] <senior7515> kali: got you. Thanks…. weird. I have a collection of bunch of stuff, but its a collection of one type. call it an enum. I do a count on that collection and I get a .count() == 1200 but after aggregating that enum field it returns 900. the 900 docs it processes are correct. just wondering why it stops. Last error returns nothing. :(
[15:24:59] <deedubs> ovaillancourt: newb question, can you change the output of MR so its not {_id: ..., value: { mystuff: true}} and is more {_id: ..., {myStuff: true}};
[15:25:18] <ovaillancourt> ??
[15:26:13] <deedubs> with mongodb mapreduce
[15:26:38] <deedubs> can you have it NOT output the {value: {}} and just return the reduce object directly
[15:26:46] <ovaillancourt> no idea :|
[15:26:51] <deedubs> Oh
[15:26:51] <kali> deedubs: what you describe is not corrent, but anyway, the answer is no. "_id" and "value" are always there
[15:27:08] <deedubs> not correct but correct?
[15:27:25] <kali> not correct
[15:27:35] <kali> {_id: ..., {myStuff: true}} <- not json
[15:28:17] <deedubs> yes... sorry didn't have jslint on my irc client :) {_id: ..., myStuff: true}
[15:39:47] <mongonub> is it possible to see how much space a document or a specific field is taking?
[15:51:38] <wereHamster> mongonub: look at the document, convert it to JSON and look how long it is. That's roughly the size
[15:52:01] <wereHamster> if you want the exact size, read about how mongodb serializes BSON. It's all there
[15:55:14] <ranman> mongonub: maybe this BSON.serialize(something).size ?
[16:19:40] <mre> In the mongo (console) how does one log the result of a command/query to a file?
[16:19:50] <mre> My GoogleFu has failed me.
[16:22:53] <ranman> ./mongo blarg --eval "query" > filetologto
[16:23:01] <ranman> or maybe something like that :P?
[16:24:48] <mre> ranman: Thanks for the confirmation, that's what I've been relegated to as well.
[16:31:28] <NodeX> mre : mongodump -d database -c collection -q '{query...}' ...
[16:32:17] <mre> Now that's interesting - Didn't know mongodump could take a query. Though obvious in retrospect.
[16:37:43] <refractal> Is it possible to do a find on an embedded array where the last element of that array equals a certain value?
[16:52:40] <senior7515> anyone here has used the aggregate framework successfully ?
[16:56:14] <ranman> senior7515: what part?
[16:56:38] <senior7515> why does it produce dupplicate keys for _id
[16:56:46] <senior7515> https://groups.google.com/group/mongodb-user/browse_thread/thread/945095e91f8e0635
[16:57:40] <senior7515> ranman: I was about to update that thread indicating that the 'count' field in the $group object does add up to be the total number of original documnts which is good.
[16:57:58] <senior7515> however it produces duplicate keys when I try to save the CommandResult (in java terms)
[16:58:08] <senior7515> duplicate keys exceptions, that is.
[17:01:06] <ranman> I'm not sure about that query sorry, I don't have the time atm to test that out, I'll post in your thread later if I do
[17:04:27] <senior7515> ranman: thanks.
[17:44:40] <Kryten001> is there some way to write mapreduce code in pure C/C++ and have it executed on a collection ?
[17:57:15] <dgottlieb> Kryten001: I think the only option is writing the mapreduce functions in javascript
[17:57:32] <Kryten001> ok thanks
[18:36:59] <souza> hi all!
[18:39:29] <souza> Guys i'm having a problem to install the C driver to mongoDB, i've downloaded the zip file, unzip it, and run the scons command, but if i try to compile some c file i got this > "fatal error: mongo.h: No such file or directory", meaning it's not finding the mongo.h file!
[18:41:34] <supe> hi
[18:41:35] <supe> How do I cache a dictionary with non Unicode (key,val) into a database? - http://stackoverflow.com/q/10920082
[18:46:12] <ranman> souza: I think you might want to run the make file, what OS are you on?
[18:47:27] <souza> ranman: ubuntu 11.10, at tutorial it says that we must to run this "scons" command.
[18:51:14] <ranman> souza: did you check out master?
[18:56:19] <mongonub> hey guys, ideas? http://pastie.org/private/mfz0cyqxdah7mtf2p2pl7q
[18:58:35] <souza> ranman: yeah, i already have the HEAD of the repositóry
[18:58:41] <souza> repository*
[18:58:50] <ranman> souza: try running make instead of scons
[18:59:00] <ranman> souza: http://api.mongodb.org/c/current/building.html
[19:01:48] <souza> ranman: i've tried with make, but when i run make test > "test/functions_test.c:71:15: error: lvalue required as left operand of assignment make: *** [test/functions_test] Error 1" the same error if i try scons test
[19:02:56] <ranman> souza: you ran make install as well? that test could just be failing right now, you can roll bag to another tag
[19:03:03] <souza> yes
[19:03:07] <souza> make and make install
[19:03:16] <souza> ranman: make and make install
[19:03:43] <ranman> souza: can you try writing quick test program to see if it's working?
[19:04:45] <souza> ranman: Just a moment, i think that using make it works
[19:10:23] <souza> ranman: thanks it works, using make
[19:10:43] <ranman> sweet
[19:11:02] <ranman> there are probably a few bugs since you're on master but just roll back to the last stable tag if something seems weird
[19:44:09] <dstorrs> I've got a collection, channel_videos_grouped. It stores data about the aggregated statistics of various YouTube publishers' videos by day. I would like to be able to run MR over it once a day and have the results appended. So, on day 1, "cnn" had stats X. on day 2, "cnn" still had those stats, and also had stats Y
[19:44:48] <dstorrs> I was keying based on channel name to make the map and reduce easy, but that means the username ends up in _id so stats always get overwritten
[19:45:06] <dstorrs> I could change the key but is there an easy way to do this?
[19:45:54] <dstorrs> something like "in the finalize function, replace the _id field with a new ObjectID()"
[19:46:20] <dstorrs> which I thought of, but I'm not sure how to do / if it's safe. thoughts?
[20:00:12] <tonyk> in Node, why is var col = new mongodb.Collection(db, 'test'); slower than the callback version?
[20:00:45] <dstorrs> because callbacks are async and what you just wrote is not?
[20:01:21] <tonyk> well, selecting a collection is a "virtual" operation, isnt it?
[20:01:27] <tonyk> it makes no sense otherwise
[20:01:39] <tonyk> it performs no queries
[20:01:51] <dstorrs> ...
[20:02:22] <tonyk> the fuck did I say wrong
[20:02:36] <dstorrs> you're going to have to excuse me. I'm hungry which makes me cranky. I can try to help, but you need to actually offer more information
[20:03:01] <dstorrs> and keep the cursing to yourself.
[20:04:11] <dstorrs> what is it that you're actually trying to accomplish?
[20:05:48] <tonyk> sorry that I offended your victorian sense of morality
[20:05:56] <tonyk> I'm trying to find out which is the best coding practice
[20:06:12] <tonyk> selecting a collection makes no sense for an async operation
[20:06:16] <wtmr> the best coding practice is to keep foul words to yourself
[20:07:03] <ranman> I'm loi-ing atm.
[20:07:35] <dstorrs> ...and I'm done here. I have no obligation to give free tech support to foul-mouthed little maggots who insult me after I offer an apology for a Poe's law violation.
[20:07:59] <tonyk> lol, keep in mind that I never called you names
[20:08:51] <dstorrs> ranman: "loi" I like that one. Much more accurate than "lol" or "rotfl", which people generally use when they are just kinda smiling quietly to themselves
[20:09:29] <wtmr> i actually
[20:09:32] <wtmr> literally rofl
[20:10:03] <dstorrs> you *literally* fell out of your chair and rolled around on the floor laughing?
[20:10:41] <dstorrs> as in, your back was in contact with carpet / hardwood / whatever?
[20:10:41] <wtmr> dude i said literally, that doesn't mean I actually do it
[20:10:51] <wtmr> it's a figure of speech
[20:10:52] <wtmr> like
[20:10:58] <ranman> like?
[20:11:00] <wtmr> "i literally died laughing"
[20:11:07] <dstorrs> er...yeah, that's actually kinda what 'literally' means
[20:11:40] <wtmr> ...and I'm done here
[20:11:48] <rossdm> loi
[20:12:11] <kali> oO
[20:13:18] <dstorrs> wtmr: I'm not being an ass (well, ok, maybe, but not JUST being an ass for the sake of it). It really is what it means! http://dictionary.reference.com/browse/literal
[20:14:29] <wtmr> i literally don't believe you
[20:15:15] <dstorrs> wtmr: Ok, now I really *am* LOL-ing
[20:15:23] <dstorrs> good one. :>
[20:15:39] <dstorrs> That is, I'm literally LOL-ing. :>
[20:15:44] <kali> http://xkcd.com/725/
[20:19:21] <dstorrs> i kan haz been xkcd'd. wtmr, u kan has mad IRC jokey-trolly-skillz. i dun bin got
[20:20:12] <wtmr> what is trolling?
[20:20:19] <dstorrs> :>
[20:20:47] <kali> I couldn't find the HIMYM episode, so I had to fallback to xkcd :)
[20:21:57] <dstorrs> ObOnTopic -- in a m/r job, what is the best (safe / fast / mem-efficient) way to change the key from 'foo' to a new ObjectId() before final output?
[20:22:26] <kali> change the key ?
[20:22:48] <tonyk> dstorrs: how about a brain transplant
[20:23:14] <tonyk> now let me drop the average age of this channel
[20:23:27] <cfitzhugh> ?
[20:23:53] <dstorrs> does that work? can I just do this: function(k,v) { return { _id : ObjectId() ... } }
[20:25:07] <kali> dstorrs: you can only affect the "value", not the _id in reduce and finalize
[20:25:36] <dstorrs> yeah, that's what I thought.
[20:25:47] <dstorrs> ok, so, basically, I need to emit a different key in my map ?
[20:26:35] <kali> if you want a different key, yes, that's the only time you have any control over it
[20:26:42] <clowny> hello guys, any one knows what means a collection called * ?
[20:26:46] <dstorrs> damn.
[20:27:06] <dstorrs> clowny: where do you see it?
[20:27:49] <clowny> dstorrs: db.* when I use show collections
[20:28:34] <clowny> dstorrs: when I use mongotop I can see it too
[20:28:51] <switz> dirka dirka mongodb jihad
[20:29:11] <dstorrs> clowny: so you're in the shell and you type 'show collections' and you see something called 'db.*' alongside more normal things like 'foo' ?
[20:29:34] <dstorrs> if so, that's odd. I suspect it was created accidentally at some point
[20:30:02] <kali> you might be able to access it with db["db.*"] in mongo shell
[20:30:33] <clowny> dstorrs: no, just this one...
[20:31:10] <dstorrs> clowny: have you tried to create any other collections?
[20:32:56] <clowny> dstorrs: yes, there is no problem actually, I just would like to know what it means, because it shows up from anywhere
[20:36:36] <dstorrs> clowny: again, I tink it was an accidental creation
[20:38:15] <clowny> dstorrs: if so, no problem, thank you for your help
[21:20:54] <geoffeg> i keep getting an exception "Invalid argument" when trying to connect to a mongod in PHP ($m = new Mongo("mongodb://localhost")) that i know is running and fine. any ideas?
[21:23:18] <linsys> geoffeg did you read the php documentation?
[21:23:26] <geoffeg> yes, a lot :)
[21:23:34] <linsys> <?php
[21:23:35] <linsys> $m = new Mongo(); // connect
[21:23:35] <linsys> $db = $m->selectDB("example");
[21:23:35] <linsys> ?>
[21:23:45] <geoffeg> right
[21:23:55] <linsys> where does it says mongodb://localhost
[21:24:12] <geoffeg> http://php.net/manual/en/mongo.connecting.php
[21:24:29] <linsys> thats for auth
[21:24:32] <linsys> are you using auth?
[21:24:37] <linsys> if not then reference this http://php.net/manual/en/mongo.tutorial.php
[21:25:01] <linsys> also make sure mongo is loaded in your php.ini
[21:25:22] <geoffeg> see the "replica sets" section of mongo.connecting.php: $m = new Mongo("mongodb://localhost:27017", array("replicaSet" => "myReplSetName"));
[21:25:53] <linsys> hmm never did that... ok then make sure mongo is loaded into your php.ini
[21:26:05] <linsys> If you are connecting to localhost just do new Mongo();
[21:26:08] <geoffeg> phpinfo says it is. 1.2.9.
[21:26:48] <linsys> You have this in your php.ini extension=mongo.so
[21:28:28] <geoffeg> yea, and i can verify it's loaded via phpinfo()
[21:28:53] <linsys> not sure then.. I've never done mongodb:// I always do "new Mongo()"
[21:29:17] <geoffeg> yea, i tried it without the protocol (mongodb://) too
[21:29:36] <geoffeg> it works fine as a command-line php script
[22:01:39] <Kryten001> Hi, I just wrote a javascript function that does a find and put the output in a new collection http://pastebin.com/zNBp7fuA
[22:01:53] <Kryten001> Is there a way I can load it in mongo and run it from C++ code ?
[22:20:58] <locojay1> hi what is the best way to chunk a collection and provide to workers? skip limit seem's natural but my understanding is that skip needs to traverse the comple colleciton. i have about 3m docs...
[22:21:56] <dstorrs> locojay1: I'm in the process of doing this now, actually.
[22:22:35] <dstorrs> Given that you say "...to workers", I assume you're using a distributed system? (Gearman, RabbitMQ, etc)
[22:22:46] <locojay1> yes zmq
[22:23:24] <locojay1> each worker get's a start and limit and does some worker...
[22:23:45] <locojay1> i mean skip
[22:23:46] <dstorrs> if so, what I've got is to have the manager run a low-processing thing that rolls through and saves jobs to the DB
[22:24:12] <dstorrs> then it tells the clients "ok, go execute on this job". the clients go to the DB for their args, etc.
[22:25:02] <dstorrs> So, basically, I punted on the "chunking it up" part and instead handled it by "do really low-effort job on all docs first, then have workers handle queueing naturally"
[22:26:24] <dstorrs> there are other options --
[22:26:32] <locojay1> manager's tell in my case go and get docs in collection from to. but skip() seem's to be slow so i was looking for an alternative. not like a seek on a file
[22:26:43] <dstorrs> you could shard the collection and then map/reduce over it
[22:26:48] <locojay1> ah k
[22:27:26] <dstorrs> what is it that you're trying to do? and what is your data?
[22:29:06] <locojay1> large collection with reference's to gridfs. each workers does some natural language processing and sends part of the coll to elasticsearch
[22:32:03] <locojay1> maybe doing a sort on _id or somethings else and doing a range query with limit is better...
[22:33:15] <dstorrs> How are you currently queuing the jobs?
[22:34:00] <locojay1> shard seems like the best solution to avoid having a 2 large col
[22:34:12] <dstorrs> I wouldn't bother doing a sort.
[22:34:24] <dstorrs> and I would avoid limit, I think.
[22:34:39] <dstorrs> doesn't feel like the right solution
[22:35:06] <dstorrs> hang on. you have lots of workers on various machines, right?
[22:35:48] <dstorrs> why do you need to do the chunking from the manager? get a cursor to the collection and just throw jobs in the queue. it's zmq's job to get them distributed -- which is, by definition, chunking.
[22:36:46] <dstorrs> how you pass those jobs over is up to you -- as a protocol request / string over the wire / separate collection / whatever -- but I think it's your best option
[22:37:49] <compufreak> How do you search for a string inside a field? ex. find any objects that have "string" in the "title" field?
[22:37:55] <locojay1> yes sending the data to the workers via a queue is cleaner than having each worker connect to mongodb and get the data since skip is slow.....
[22:39:10] <dstorrs> no, I mean, have the manager queue up jobs with args like this: { name => 'nlp_user", user => "bob" }
[22:39:44] <dstorrs> the worker gets the queue request and says "ahah. when I get an 'nlp_user' command, I know to go to the DB and pull data for "bob" and do my stuff on it
[22:39:54] <dstorrs> "
[22:40:06] <locojay1> sure but it same job on all the data :)
[22:41:02] <locojay1> the complete collection needs to be processed.....
[22:41:07] <dstorrs> why?
[22:41:42] <dstorrs> put an index on the 'user' field and, as the Brit's say, Bob's your uncle
[22:43:01] <locojay1> thanks will not bee equaly distributed but who care's...
[22:43:12] <dstorrs> yep.
[22:43:28] <dstorrs> All you care is the work gets done in time and accurately. Let zmq figure it out.
[22:47:37] <LesTR> hi, can someone help me with replicaSet problem please? We have a "large" replicaSet - 3 server's each has 16GB ram. ~200GB of data, index's size ~8GB. Now we have problem with slave delay, but only on one
[22:48:12] <dstorrs> LesTR: I don't know that I can help, but I'll try. But I need to see actual error messages / output, etc.
[22:48:36] <LesTR> 2 OK server's are absolutly identical and one problematic slave has +2 CPU(with TH)
[22:48:52] <LesTR> i don't have now access to ssh :(
[22:49:01] <LesTR> only mongo console :(
[22:50:13] <LesTR> dstorrs: can be problem with +2 CPU?
[22:50:20] <dstorrs> I wouldn't think so.
[22:50:29] <dstorrs> but without some sort of specifics I can't really help
[22:51:01] <LesTR> me too, but its only one diferent
[22:51:35] <dstorrs> here's the only thing I can offer -- http://docs.mongodb.org/manual/replication/ It's the most recent docs. sorry it's not more, and good luck.
[22:52:06] <LesTR> hm, ok, thx for time
[22:52:11] <dstorrs> np.
[22:52:34] <LesTR> can u give me please any hint for checking logs?
[22:52:34] <dstorrs> btw, you do understand that "eventually consistent" means "there may occasionally be small slave delays", right?
[22:53:05] <dstorrs> I'm assuming that you're actually seeing a significant ongoing issue.
[22:55:02] <dstorrs> LesTR: nothing comes to mind. I haven't done Mongo replication myself (hence the up-front "I don't know that I can help, but I'll try")
[22:55:47] <dstorrs> I will say this -- I can answer almost every question that comes into this channel, and that's based only on extensive reading. There's a lot of good info / docs out there.
[22:56:14] <dstorrs> just make sure what you're reading is doing about a version equivalent to yours
[22:59:16] <LesTR> sorry, my ssh connection on server with irssi died
[22:59:34] <LesTR> i have basic info about replication
[22:59:36] <dstorrs> no worries
[22:59:47] <LesTR> but i can't find problem here
[23:00:10] <LesTR> because second slave are ok and have "same" trafic
[23:00:34] <LesTR> and sure, this isn't "small" delay
[23:00:48] <LesTR> = 8120 secs ago (2.26hrs)
[23:02:38] <rdegges> Yo! I'm using pymongo, and what I'd like to do is essentially an insert_or_get type operation: I'd only like to insert my new document if it doesn't exist in the database already.
[23:02:52] <rdegges> Is there a way to do that? I can't find any information in the pymongo documentation.
[23:03:31] <clowny> hello guys, does anybody knows if mongodb preferably keeps the indexes always on memory or it just do LRU ?
[23:04:02] <dstorrs> rdegges: insert_or_get ... that doesn't make sense to me. insert is a modifying op when you have data, get() is a retrieval op when you have partial data
[23:04:37] <rdegges> dstorrs: well, I'd like to only insert my data if it doesn't already exist.
[23:04:54] <rdegges> So instead of doing like, if blah.find_one({}): blah.insert({})
[23:05:02] <rdegges> I'd like to do it in a single operation.
[23:05:08] <dstorrs> ok...why not just do the insert() ?
[23:05:16] <rdegges> Oh, I should probably explain that, d'oh.
[23:05:22] <dstorrs> inserting the data twice is idempotent
[23:05:27] <rdegges> I'm looking specifically for a key.
[23:05:53] <dstorrs> clowny: sorry, dunno
[23:05:54] <rdegges> EG: Insert this data if it doesn't exist in the DB, OR if it exists in the DB AND it has a certain key set.
[23:06:00] <rdegges> So, if I have:
[23:06:17] <rdegges> {'a': 'b'}, that I want to insert. And my db contains {'a': 'b', 'c': 'd'}
[23:06:25] <dstorrs> real data please
[23:06:28] <rdegges> I want to overwrite my db contents and get rid of the 'c': 'd' key
[23:06:38] <dstorrs> truncated if you like, but not 'a' 'b'
[23:06:41] <rdegges> So I'm storing postgresql database credentials.
[23:06:59] <rdegges> {'name': 'databasea', 'url': 'postgresql://....'}
[23:07:11] <rdegges> and sometimes, a database will also have an 'in_use' key
[23:07:16] <rdegges> Which specifies taht db is in use by someone else.
[23:08:54] <dstorrs> hm
[23:09:11] <LesTR> this isn't possible, imho
[23:09:14] <dstorrs> You are in a maze of twisty little race conditions, all horrible.
[23:10:08] <dstorrs> I think your solution is going to have to involve refactoring your data model, not your application logic. but that's just a guess at this point
[23:10:58] <werkshy> hi guys. i'm having a problem retrieving only certain nested fields in pymongo
[23:11:09] <werkshy> db.logEventByHour.find({}, {"logs.hour":1}) works in teh mongo shell
[23:11:27] <werkshy> but passing fields = {"period" : 1, "logs.hour": 1} doesn't work in pymongo
[23:11:31] <werkshy> https://gist.github.com/2885383
[23:12:19] <dstorrs> werkshy: is there actually a field called 'period' ?
[23:12:20] <werkshy> just spits back empty dictionary for each element in 'log' array
[23:12:23] <werkshy> yes
[23:12:49] <werkshy> sorry, can leave period out of fields for this example
[23:13:29] <werkshy> i was looking for a known issue in pymongo but couldn't find one
[23:13:44] <dstorrs> show me a record that you expect to match
[23:13:48] <dstorrs> (gist it)
[23:15:14] <werkshy> example document: https://gist.github.com/2885418
[23:16:18] <werkshy> i can live with retrieving the whole log subdocument, but i'd like to open a ticket if this is supposed to work
[23:24:26] <werkshy> dstorrs: sorry, i have to go. i will raise this on the mailing list. thanks
[23:24:32] <dstorrs> np
[23:24:40] <dstorrs> I was just playing with it trying to get it to fail
[23:24:43] <dstorrs> so far, I can't
[23:24:46] <dstorrs> good luck, though
[23:57:43] <Kryten001> Hi, I just realize that import and require are not allowed in mapreduce code, is it true? is there a substitute ?