PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 10th of May, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:22:54] <scoutz> what is the best way of shutting down a mongos? Can I just kill the process?
[00:33:49] <uptownhr> db.searches.runCommand( "text", { search: '"testing\' testing"',filter:{type_id:2}, limit: 2 } );
[00:33:58] <uptownhr> any reason why the \' escape is not working?
[00:34:03] <uptownhr> i'm running this from my shell
[00:35:33] <uptownhr> whenever i add the \ escape, '...' is outputed
[00:36:07] <uptownhr> ...
[01:22:57] <scoutz> I'm trying to convert my replica set to replica shard on mongos I'm adding the first replica set and getting "not authorized for command: addShard on database admin"
[01:23:23] <scoutz> started all mongos and mongos' with --keyFile
[03:46:40] <freon> hi, how do I sort one collection by values in another collection?
[08:07:15] <rhalff> odd, I'm looking at the findOne() function, why is there a test whether it returns more than one result in it?
[08:07:44] <rhalff> Isn't that like putting test code inside a production function.
[08:10:51] <kali> rhalff: which findOne() are you talking about ?
[08:12:07] <kali> sh.shardCollection( "some.collection", {_id: "hashed" }) tells me { "ok" : 0, "errmsg" : "shard keys must all be ascending" } . anybody knows what's wrong ?
[08:12:38] <rhalff> kali, just the definition of the function itself
[08:12:58] <kali> rhalff: in which driver ?
[08:13:07] <kali> rhalff: ha, i nthe shell, maybe ?
[08:13:08] <rhalff> kali, directly in the console
[08:14:01] <rhalff> kali, anyway I'm just following the first chapter of a book, I've not done anything yet with mongodb :-)
[08:14:07] <kali> rhalff: this is just client side. tbh, i don't think the server has a findOne, even if every driver will recreate one
[08:14:59] <kali> rhalff: and you won't use the shell for production, so it's fine
[08:15:01] <rhalff> kali, ah I understand
[08:15:12] <rhalff> ok, thanks :-)
[08:23:42] <rhalff> I'm jealous with the younger generation they might never have to learn SQL
[08:24:09] <kali> :)
[08:35:20] <kali> i've found what's wrong with my sharding, if somebody was wondering :P
[08:40:34] <Nodex> it was broke and not working?
[08:40:35] <Nodex> :P
[08:47:37] <kali> Nodex: i had a few 2.2 mongos lost in the grid :)
[08:47:47] <Nodex> ouch
[08:48:01] <kali> Nodex: now i've a nagios probe.
[08:49:02] <Nodex> is Nagios easy to setup with Mongo?
[08:51:06] <kali> Nodex: i'm actually using icinga, and we have a 10-line ruby script that connects and calls .database_names
[08:54:14] <kali> ha yeah
[08:54:16] <kali> through munin
[08:57:52] <Nodex> I used to have munin but got rid of it when I simplified my stack
[08:58:40] <kali> we're fading it out, actually
[08:58:54] <kali> replacing with a mix of collectd and graphite
[08:59:12] <kali> with a 10 seconds resolution on several hundreds vitals :)
[08:59:43] <kali> we found dozen of issues that were buried in munin's 5 minute window
[09:00:34] <Nodex> I want to start using graphite for stats
[09:00:43] <Nodex> Not had the time to get into it yet :/
[09:23:44] <bcave> hi there.
[09:25:41] <bcave> I am trying to build a mongo query in java. i am trying to query by Object ID (I have the ID in string format), and now trying to build a query in java along the lines of "{ _id : { $in : [ ObjectID('1'), ObjectID('2')]}}". http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-java-driver/ isn't giving me the info I need to get this query right and i'm not finding results on google...
[09:30:50] <Nodex> as long as it's being cast correctly it should work ifne
[09:30:52] <Nodex> fine *
[09:33:11] <rhalff> why is node-mongodb-native written in javascript and not in C++, or is the compiled javascript just as fast? e.g. https://github.com/rhalff/node-imagemagick-native/blob/master/src/imagemagick.cc
[09:40:12] <bcave> Nodex: thanks. it was to do with my query syntax. I was trying "ObjectId('333')" for the OID, but the syntax for an object ID in java is "{ $oid : \"3434\" }"
[09:40:28] <bcave> so once i switched to that, my query is working, but onto the next problem. :)
[09:44:16] <kali> bcave: building queries in json string is not recommended. you should consider using the java native DBObject / DBList /... instead
[09:45:20] <kali> bcave: building query as string is dangerous, it exposes you to injection
[09:50:31] <bcave> kali: it's being implemented in a framework that has limitations around that. Talend.
[09:51:23] <bcave> it's not for a webapp, internal manual use only. exposure is minimal, so I doubt there'll be any room for exploits ;)
[09:59:16] <bcave> so insight into my next issue, now that my query is working.... "BSONDecoder doesn't understand type : 115 name : stName"
[09:59:40] <bcave> so it looks like I'm getting the tail end of a fieldname back from the response. some sort of truncation happening
[11:15:13] <chandru_in> Is a background index always updated in the background or does only creation happen in the background?
[11:16:10] <Nodex> only creation
[11:23:18] <chandru_in> Nodex, Thanks
[11:28:43] <Nodex> :)
[11:43:43] <pratz> Hello guys
[11:43:49] <pratz> I am using Python adapter
[11:43:56] <pratz> http://api.mongodb.org/python/current/api/gridfs/grid_file.html
[11:44:18] <pratz> how can i specifiy the 'encoding' keyward argument in gridfs ?
[11:44:33] <pratz> fs.put(u'just a test', encoding=True) , this does not seem to work
[11:45:19] <Slyth> hi
[11:45:25] <Slyth> i have a question
[11:45:37] <Slyth> i want to testing mongodb sharding
[11:45:41] <Slyth> i have 2 pc
[11:46:17] <Slyth> i start mongod.exe --shardsvr on first pc
[11:46:37] <Slyth> i start mongod --configdb on second pc
[11:47:01] <Slyth> but i cant start mongod --shardsvr on second pc
[11:47:37] <Slyth> it say mongod instance already running
[11:48:07] <Slyth> anybody help me ?
[11:49:50] <kali> Slyth: http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/
[11:51:15] <Slyth> thnx
[12:37:23] <newbsduser> mongo --eval "printjson(db.serverStatus())" "127.0.0.1:27017/?connectTimeoutMS=5" <--- does it work correctly for 5 seconds connection timeout? to 127.0.0.1 port 27017 ?
[12:40:57] <Nodex> I am not sure that's a valid connection string for the shell
[12:41:22] <Nodex> and it would be Milliseconds not Seconds
[12:43:08] <newbsduser> it worked
[12:43:33] <newbsduser> Nodex, some times mongodb hangs.. i check with lsof -p mongodbpid
[12:43:41] <newbsduser> it listens socket but it s not answering
[12:44:03] <Nodex> how come you asked if it worked before just simply trying it ?
[12:44:07] <newbsduser> if i delete logfiles of mongodb it works again
[12:44:35] <newbsduser> mongo --eval "printjson(db.serverStatus())" "127.0.0.1:27017/?connectTimeoutMS=5" <---- it gives me valid output
[12:44:52] <newbsduser> but i didn't try it on hang stutiation
[12:45:53] <newbsduser> i think i should use mongodb in production in silent mode
[12:46:00] <newbsduser> without logging
[12:46:30] <Nodex> that's not really a very good idea
[12:47:43] <newbsduser> mongo --eval "printjson(db.serverStatus())" "127.0.0.1:27017" <---- some times this command hangs.... it says "Connecting..." and wait for a hour
[12:48:23] <newbsduser> Nodex, and actually mongodb instance is up... and iam sure this problem is related with logging system
[12:49:12] <newbsduser> because when i delete all logs /service/mongodb27017/* ( <----- iam using daemontools to control mongodb instance) session resumes and working well
[12:49:45] <newbsduser> do you have any idea about this problem?
[12:51:04] <Nodex> running out of disk space maybe?
[12:59:45] <newbsduser> Nodex, no there s space on disk
[13:01:21] <Nodex> is /service a network path?
[13:12:29] <newbsduser> Nodex, /service is daemontool's service path
[13:12:48] <newbsduser> http://cr.yp.to/daemontools/faq/create.html
[13:15:16] <Nodex> I don't know what that is sorrry
[13:15:35] <Nodex> sounds to me like it's a problem with whatever that is ^^ seeing as it probably works fine without it
[14:06:00] <yfeldblum> where can i find a reference manual of which javascript array methods are available in mongodb v2.2?
[14:06:33] <yfeldblum> in the server, not the shell, for doing operations like group
[14:09:33] <kali> yfeldblum: you're aware of the existence of the aggregation framework ?
[14:10:21] <yfeldblum> kali, quite aware, yes, but that's not what i'm looking for at the moment
[14:11:25] <yfeldblum> kali, for example, Array.prototype.reduce seems to be present in v2.4 but absent in v2.2; i'm looking for a reference manual on what exactly is available in the server-side javascript
[14:12:42] <kali> yfeldblum: i'm not sure there is such a thing, but 2.2 use spidermonkey, while 2.4 use v8. most of the differences are listed there: http://docs.mongodb.org/manual/release-notes/2.4-javascript/
[14:16:39] <yfeldblum> kali, any idea what version of javascript was shipped with the mongodb-v2.2 spikermonkey?
[14:17:02] <yfeldblum> kali, e.g. js 1.6? js 1.8? i'm looking at this page: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array
[14:19:17] <kali> yfeldblum: according to my build script log, we were building it againt js-1.7
[14:19:25] <yfeldblum> kali, ty
[14:19:26] <trupheenix> how can i set up a replicated shard?
[14:19:36] <kali> yfeldblum: but i don't know what 10gen used to ship
[14:22:40] <kali> trupheenix: just setup a replica set and add it to your sharded setup like there: http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/#sharding-setup-add-shards
[14:48:21] <phrearch> hey
[14:48:21] <starfly> kali: I thought that we use the aggregation framework to set up a replicated shard? ;)
[14:49:01] <phrearch> im wondering if with mongoose its possible to query polymorphic models with a common object, like query all vehicles, whether that are cars or busses
[14:49:33] <phrearch> hm
[14:49:33] <phrearch> https://github.com/briankircho/mongoose-schema-extend
[14:49:38] <phrearch> sorry for the spam :)
[14:57:41] <Nodex> phrearch : if you had a key called "vehicles" then you can just query vehicles:{$exists:true}
[14:59:36] <phrearch> Nodex: ok thanks
[14:59:56] <phrearch> thats a nice one
[15:29:19] <trtz> Why MongoDB sucks: http://dev.pocoo.org/~mitsuhiko/mongodb.pdf
[15:46:52] <kali> nice.
[15:48:18] <ron> entertaining.
[15:49:05] <rhalff> trtz, tell me why
[15:49:24] <kali> rhalff: he's gone...
[15:50:21] <rhalff> kali, he was silenced ? :-o
[15:52:33] <ron> nope
[15:52:35] <ron> he ran away
[15:53:47] <kali> rhalff: nan, he just shat in the garden and ran away
[15:54:49] <Nodex> "why mongo sucks" - Answer = "Because I don't know how to use it and expect it to do everything that I want out of the box with no learning curve and must be CAP and ACID complient else it must suck
[15:55:11] <rhalff> kali, ok nevermind, I just spend 12 hours learning about node.js and mongodb etc. So I'm sorry if I show troll behaviour :-)
[15:55:37] <Derick> slide 60 is incorrect too
[15:55:42] <Derick> there are no two network round trips
[15:56:08] <Nodex> the whole PDF is a fail .... they picked the WRONG db for thier project
[15:56:21] <Nodex> "schemaless is wrong" = FALSE
[15:57:14] <Nodex> using anything on EBS without a cache is also an EPIC fail
[15:57:33] <Derick> Slide 84.... is funny
[15:58:16] <Nodex> "Schema vs Schema-less is just a different version of dynamic typing vs. static typing" - dumbest thing I have ever heard and I talk to myself LOL
[16:00:08] <Nodex> the guy knew all these things he's poiinting out regarding Joins/transaction before he started to use it... so why rant about it lol
[16:01:34] <Nodex> page 83 - when do people ever use ":" or "*" or "|" in table/collection names anyway .. wtf
[16:02:35] <Nodex> nice waste of 10 mins there LOL
[16:10:35] <Nodex> new nodex site inbound soon - not bad for a days work http://www.stage.nodex.co.uk/ :D
[16:13:51] <rhalff> Nodex, fake, your copyright is still 2010
[16:13:52] <rhalff> :p
[16:14:12] <Nodex> I thought it had to be from when the domain was first online?
[16:14:46] <Nodex> not somehting I know a lot about tbh
[16:15:32] <rhalff> Nodex, neh it's cooler to have @1996-2013 offcourse you can update it automagically
[16:15:56] <Nodex> good point
[16:16:34] <rhalff> anyway, you shouldn't lie about when you started, that's not cool ofcourse and verifyable. :-)
[16:17:00] <Nodex> the company was formed in 2008 in actual fact but only registered LTD in this year
[16:17:18] <rhalff> so something to be proud of
[16:17:50] <rhalff> anyways, that's just how I interpret it, but I'm weird.
[16:18:18] <Nodex> lol
[16:40:43] <kida78> mongodb using the OS cache is awesome, but how the heck can you take real measurements when tweaking a query if you can't compare apples to apples
[16:40:43] <kida78> the
[16:40:56] <kida78> the first run is gonna be slow, but subsequent ones will be superfast
[16:41:05] <kida78> (trying to optimize aggregation() commands)
[16:41:24] <kida78> and happy friday to you all
[16:45:06] <bean__> kida78: if you really wanted to test you could drop caches.
[16:45:31] <kida78> is this not dangerous systemwide? or is there a way to focus on mongodb
[16:45:31] <bean__> kida78: i believe, on most linux boxen, you can do: echo 3 > /proc/sys/vm/drop_caches
[16:45:32] <kali> kida78: http://linux-mm.org/Drop_Caches
[16:45:57] <bean__> i wouldn't call it dangerous, but I probably wouldn't run it live on prod.
[16:46:19] <kida78> there's no way to tell mongodb not to use the cache
[16:46:33] <Number6> kida78: The OS decides what to put into the cache
[16:46:44] <kida78> is this what you use to tweak and optimize your queries
[16:47:11] <kida78> i've been running a batch aggregation job
[16:47:27] <kida78> which iterates through about 100k records and aggregates data for each one
[16:47:32] <kida78> a single run not using the cache can take 22 hours
[16:47:35] <kida78> using the cache can take 30m
[16:48:21] <kida78> the difference is incredible
[16:48:33] <Number6> kida78: Disk seeks will do that :-)
[16:49:10] <bean__> disk is slow
[16:49:13] <bean__> memory is fast
[16:49:14] <bean__> :)
[16:49:34] <kida78> yezzz
[16:49:50] <Number6> Fetching a soda from the fridge is like using memory. Driving 4 hours and getting soda in a shop, then driving home to drink it would be the time frame you're looking at when hitting disk
[16:50:15] <Number6> Which is why Linux stores stuff in cache.
[16:51:04] <kida78> haha all for soda
[16:51:21] <kida78> another option is to run the thing every day to keep things in memory
[16:51:49] <kida78> if I ensure a new index on a 30m record collection, would this stop the presses?
[16:52:28] <Number6> kida78: You can use touch and a find().explain() to help preload data into RAM from disk
[16:53:14] <kida78> well its not a find query but a aggregate()
[16:53:52] <kida78> unless you mean do a find().explain() on what the $match portion would do
[16:55:36] <Number6> No, after restarting / Starting mongoDB, run a touch and a find and explain. This will load your documents into memory - think of it like warming up the database
[17:23:03] <Nodex> @Number6 : that's a good tip.... does everything need to be touched - i/e all dataabases?
[17:43:12] <mgriffin> mongoperf.. neat
[17:43:39] <mgriffin> was looking to see if mongod could run o_direct for that drop caches question a bit ago and found this
[17:46:35] <kida78> mongoperf?
[17:48:18] <ehershey> https://github.com/mongodb/mongo-perf ?
[17:57:30] <mgriffin> echo "{nThreads:32,fileSizeMB:1000,r:false, w:true, mmf:false}" | mongoperf
[17:57:57] <mgriffin> http://docs.mongodb.org/manual/reference/program/mongoperf/
[17:58:03] <kida78> mongoperf and mongo-perf are two different things
[17:59:08] <mgriffin> 1685 ops/sec 6 MB/sec
[18:04:33] <kida78> are $in queries performant, if that field is indexed?
[18:06:30] <kali> kida78: yes
[18:06:37] <kali> kida78: well, as much as you can expect them
[18:06:47] <kali> + to be
[18:06:51] <kida78> faster to run separate exact matches for each?
[18:06:59] <kali> yeah, you save the round trips
[18:07:47] <kali> it's a frequent use case, as it is one of the way to implement join, and it is optimized
[18:14:07] <kida78> oh so the $in is optimized over running separate, got it
[18:14:51] <kida78> i wonder if this would work as a way to clear the cache.
[18:14:55] <kida78> 1) run a query, record time
[18:14:59] <kida78> 2) clear the data
[18:15:03] <kida78> 3) run the query again
[18:15:06] <kida78> 4) reload the data
[18:15:10] <kida78> 5) run the query
[18:15:27] <kida78> otherwise, clearing the cache locally is going to require a system restart every single time
[18:18:30] <mgriffin> kida78: i read about that a bit in http://snmaynard.com/2012/10/17/things-i-wish-i-knew-about-mongodb-a-year-ago/ yesterday
[18:19:36] <kida78> so yeah i read that too, what does it mean to index queries
[18:19:56] <kida78> especially for a job that basically entails 200k separate aggregation calls
[18:21:10] <kali> kida78: you have to be aware that your use case is not typical: mmongo is not design for table scan but for short, fast, small queries
[18:21:22] <kali> kida78: so this comment obviously does not apply
[18:21:26] <kida78> right
[18:21:41] <kida78> i'm thinking i will have to alter the indexes a bit
[18:22:00] <kida78> as well as, move some of the processing outside of the aggregation query
[19:00:55] <devvy> Hi all. Not sure if this is the right place for this sort of question, but I'm looking at using MongoDB for building a dynamic database feature where users can essentially create their own databases for keeping track of data in their own format. The user would essentially be able to create what would be synonymous to a table, then pick and choose their columns/datatypes, the order of each, and possibly some sort of validation rules. They would
[19:00:56] <devvy> be able to record and view data with some basic searching and sorting functionality on each column. There's a possible future requirement to be able to associate records with records from other custom tables. I've looked at using an EAV model with something like MySQL, but further reading seems to indicate a schema-less solution like MongoDB may be more apt. What are your thoughts? Is MongoDB viable tool for the job?
[19:03:49] <Gargoyle> So you want to create a relational DB using a non-relational one! Are you mad?
[19:07:12] <devvy> Sort of. The only relational element is the possible association of records between models. I suppose it's a tradeoff between the relational advantages of an RDBMS vs the unstructured/schemaless benefits of a document oriented DB.
[19:09:04] <Gargoyle> devvy: Can't you just charge your clients to teach them to use excel!
[19:09:06] <Gargoyle> ;)
[19:09:17] <devvy> haha i wish
[19:35:21] <yeukhon> I use mongoengine in my web project. and i am getting this strange error: OperationFailure: command SON([('filemd5', ObjectId('518d4a904b8aa409bdf9fafa')), ('root', u'fs')]) failed: need an index on { files_id : 1 , n : 1 }
[19:35:29] <yeukhon> here is the log from mongodb. https://gist.github.com/yeukhon/8fbe2a2fd6454e264ab8
[19:35:57] <yeukhon> i googled a bit but i am not sure why the error is complaining about the index.
[19:36:19] <yeukhon> using the latest 10gen version on ubuntu
[19:36:57] <yeukhon> any suggestion on how to debug this issue? thx
[19:46:30] <kali> yeukhon: well, the query does need the index
[19:46:38] <kali> yeukhon: so i would add the index :P
[20:29:33] <someprimetime1> Can someone help me figure out how to sort by hour, day, year with this query? http://pastie.org/7828346 I know basically I need to do something like var now = new Date(); and like one day would be now.getDate() - 1 but what method would I use?
[20:45:02] <novochar> after doing "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10"
[20:45:07] <novochar> then "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list"
[20:45:25] <novochar> apt-get update failed because "W: GPG error: http://downloads-distro.mongodb.org dist Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9ECBEC467F0CEB10"
[20:45:37] <novochar> i'm following along with http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
[20:46:50] <novochar> maybe it should be --recv 9ECBEC467F0CEB10 ?
[20:50:03] <ehershey> novochar: what's your os?
[20:50:29] <ehershey> can you run lsb_release -d ?
[20:50:48] <novochar> Ubuntu 12.04.1 LTS
[20:57:59] <novochar> i wasn't able to verify the key, and i would like to do that still, but i was able to install mongodb nevertheless
[20:58:23] <novochar> do you have to savet the database state after you insert something?
[20:58:24] <ehershey> you didn't get an error or anything from the apt-key command?
[20:58:37] <novochar> i didn't
[20:58:44] <novochar> just when i did an apt-get update
[20:58:48] <ehershey> can you do apt-key list?
[20:58:52] <ehershey> and see if this shows up?
[20:58:52] <ehershey> uid Richard Kreuter <richard@10gen.com>
[20:58:53] <novochar> sure
[20:59:24] <novochar> it's not on there
[20:59:48] <novochar> apt-key list | grep -i -r richard
[21:00:01] <novochar> #command used in case any doubts
[21:00:39] <ehershey> it sounds like the apt-key adv command didn't do what it was upposed to
[21:00:48] <ehershey> can you run it again and send the output?
[21:01:22] <ehershey> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
[21:04:01] <sudobangbang> i'm getting RangeError: Maximum call stack size exceeded when i try to make a mongoose.connect( <connections_string> )
[21:04:02] <sudobangbang> after declaring: var Schema = mongoose.Schema;
[21:04:04] <sudobangbang> but if i remove the Schema declaration the connection works fine
[21:04:06] <sudobangbang> any ideas?
[21:04:12] <novochar> ehershey: you got it
[21:04:32] <novochar> ehershey: there it is
[21:04:59] <novochar> it might have been that i ran the "sudo apt-key adv..." command while already being logged in as root?
[21:05:11] <novochar> sudobangbang: i'd like to help you, but i'm just getting started myself
[21:05:16] <novochar> sorry about that
[21:05:54] <leostera> sudobangbang: I have some experience with Mongoose
[21:06:38] <leostera> sudobangbang: can you make a gist so I can have a look around?
[21:07:35] <leostera> sudobangbang: or if you can't share the source, send me a pm
[21:08:24] <sudobangbang> yeah
[21:10:05] <a13x212> any gotchas with using mongodump?
[21:10:55] <leostera> a13x212: not that I'm aware of, make sure you are dumping in a clean folder and you should be fine
[21:11:57] <sudobangbang> leostera: thanks for the look...still getting the error with this code...forget what i said before
[21:11:58] <sudobangbang> http://dpaste.com/1136796/
[21:12:53] <a13x212> leostera, safe to run on live system? database is about 400GB
[21:13:26] <leostera> a13x212: can't talk about such a big db, worked fine with 70gigs but never tested it to 400gb
[21:13:49] <leostera> s/it to/it on/
[21:14:16] <leostera> sudobangbang: ok, let's see...
[21:14:21] <a13x212> but it is non-blocking correct? i keep thinking of mysqldump :)
[21:15:56] <leostera> a13x212: both dump and restore are nonblocking
[21:16:18] <leostera> a13x212: so *you* have to make sure it is the desired snapshot for backup/restoring
[21:17:27] <leostera> a13x212: I figure that for 400gb it will generate quite a big load so best to do it when not in high peak hours
[21:17:58] <leostera> a13x212: if anything, take a look at this: http://docs.mongodb.org/manual/core/backups/
[21:18:04] <leostera> sudobangbang: back to you
[21:18:51] <leostera> sudobangbang: can you minimize the clutter?
[21:19:03] <a13x212> got thanks leostera
[21:19:25] <leostera> sudobangbang: it might be possible that connect doesn't establish a connection by the time you try to register a schema/model
[21:19:49] <leostera> sudobangbang: having the on error, on open and on close callbacks log out the status is useful for this situations
[21:20:02] <sudobangbang> yeah, maybe i'll through it into the db.once( ) as a handler
[21:20:12] <sudobangbang> is there a way with mongoose to code by events?
[21:20:28] <sudobangbang> so instead of callbacks i can declare events like with the nodejs postgres stuff?
[21:20:33] <leostera> sudobangbang: try using the connect callback to define the schema and well see
[21:20:43] <leostera> sudobangbang: you'll have to add that functionality manually afaik
[21:20:49] <sudobangbang> k
[21:21:14] <leostera> sudobangbang: but it shouldn't be that hard, just add a subscriber to a db:connected event and publish it from within the connect callback
[21:21:26] <leostera> sudobangbang: let me know how it goes
[21:21:28] <sudobangbang> yeah
[21:21:33] <sudobangbang> thanks leostera
[21:21:41] <leostera> sudobangbang: anytime
[21:21:47] <leostera> a13x212: anytime
[21:29:28] <sudobangbang> leostera: that fixed the immediate issue but it also uncovered more "RangeError: Maximum call stack size exceeded" regrading node event module...fuck me
[21:30:13] <leostera> sudobangbang: is there a reason you need to use eventemitter2?
[21:30:39] <novochar> still reading the tutorial, what's the relationship of a database and a collection?
[21:30:43] <sudobangbang> yes, because it's useful ;-)
[21:30:45] <novochar> database contain collections?
[21:30:53] <leostera> novochar: a database contains collections, correct
[21:30:57] <novochar> is there a way to put a collection within a database?
[21:31:16] <leostera> sudobangbang: at #nodejs they might help you out with eventemitter2
[21:31:28] <novochar> it's not immediately obvious that test_database contains test_collection right now, if that's the case
[21:31:52] <leostera> novochar: it never is, until you get how it works. Don't worry too much thou
[21:33:22] <TommyCox> novochar: Maybe a admin like rockmongo might help you visualize the structure
[21:33:39] <leostera> sudobangbang: for someone who claims to use a node module for its beauty you write pretty distasteful code :)
[21:33:52] <leostera> novochar: on mac you can use MongoHub
[21:33:59] <sudobangbang> how's that leostera
[21:35:46] <kida78> back
[21:36:00] <kida78> do we have any aggregation framework experts in here? wanna bounce some ideas
[21:36:18] <TommyCox> kida78: I'm decent, ask away
[21:36:35] <kida78> i have a collection who's data looks like this
[21:36:39] <leostera> sudobangbang: well, for starters your indentation is inconsistent. Sometimes you leave a new line between lines, sometimes you don't. Your variable notation is somewhat consistent. You should mess less with prototype as well…specially in the built-in objects, you might break some internals (counters mostly).
[21:37:25] <kida78> { a: 'frank', b: 'tony', c: Date() }
[21:37:36] <kida78> where the id is a hash of all 3
[21:37:58] <kida78> so i'm running an aggregation where i want the end result to be { a: frank, b: tony, rows : 4 }
[21:38:15] <kida78> basically how many separate rows where a = frank and b = whatever
[21:38:21] <kida78> so for example, the result could be
[21:38:36] <kida78> { a: frank, b: tony, rows: 4 }, {a: frank, b: sally, rows: 6 }, etc
[21:38:38] <leostera> sudobangbang: data-id is not a valid variable name, nor is location-hash. So car_instance.data-id…and you get my point.
[21:38:47] <kida78> the aggregation that i've put together works, but its so slow
[21:38:53] <kida78> its a 30m row collection
[21:39:09] <kida78> currently on the collection only a is indexed, not a, b
[21:39:19] <TommyCox> Are a, b, and c indexed?
[21:39:23] <TommyCox> oh
[21:39:23] <TommyCox> lol
[21:39:34] <kida78> my aggregation is a match on a = frank, a projection on the fields, and a group by B
[21:39:49] <TommyCox> can you past bin your current aggregation
[21:39:57] <kida78> yeah sure
[21:41:40] <kida78> just cleaning it up...
[21:45:11] <kida78> i'll json pretty it
[21:46:32] <kida78> http://pastebin.com/Z430whwZ
[21:46:45] <kida78> there's a and b
[21:46:56] <kida78> a can buy b drinks, a can ask b on a date
[21:47:08] <kida78> so i'm counting all the dates and drinks between person a, and all possible B's
[21:47:34] <kida78> where every event is a diff doc
[21:48:05] <kida78> its a match, project, group, project, group, sort
[21:48:12] <kida78> fun stuff eh
[21:48:50] <TommyCox> sorry, was hopping around other channels. looking now
[21:49:38] <kida78> no worries
[21:49:44] <kida78> i'm thinking of only doing the first match,project,group, and then doing the rest in the code.
[21:49:50] <kida78> but check it out and lemme know what u think
[21:52:07] <TommyCox> by chance can you paste bin a couple sample docs?
[21:53:04] <kida78> oh sure
[21:53:20] <locojay> hi running 2- replicaset. when adding auth=true in boath conf i get or using --auth i get replset error could not reach/authenticate against any members
[21:53:43] <locojay> heartbeat failed, retrying
[21:56:08] <kida78> http://pastebin.com/XK7vxMtj
[21:56:12] <kida78> TommyCox: here ya go http://pastebin.com/XK7vxMtj
[21:56:19] <TommyCox> Thanks mate
[21:57:04] <kida78> (y)
[21:58:40] <TommyCox> hm, the second doc isn't valid json. maybe you accidentally mucked it when cleaning?
[21:59:46] <kida78> yup I did
[21:59:52] <kida78> saving new pastebin....
[21:59:58] <kida78> http://pastebin.com/t9tyeJ95 voila
[22:00:03] <TommyCox> gracias
[22:03:53] <kida78> granted the indexes are a, count and b, count
[22:03:59] <kida78> i have not indexed a,b or b,a
[22:04:04] <kida78> (since i do the aggregation both ways)
[22:06:14] <locojay> all fine when auth=true is commented out. but adding auth to either of the 2 conf generates replset error could not reach/authenticate against any members. any idea?
[22:14:37] <kida78> TommyCox: did the last one work or was it still busted? what are you trying out?
[22:15:05] <TommyCox> I am just trying to run the match and project to see the structure of what you're grouping
[22:15:33] <kida78> ah okay
[22:24:55] <TommyCox> Whew, okie dokie. So to clarify, you just want the count of the rows where a has b?
[22:25:25] <kida78> count of the rows, as well as total number of dates and drinks
[22:25:54] <kida78> the first 3, i believe gives you the count of date rows, and drink rows, as separate results for the same person
[22:26:00] <kida78> the last few in the pipe, puts it all together
[22:26:10] <TommyCox> well, it tries, but doesn't appear to be working
[22:26:18] <kida78> which part
[22:26:28] <TommyCox> the count of drinks and dates seperately
[22:27:10] <kida78> you're talking about the first match, project, and group, right?
[22:28:26] <kida78> do you see { _id : { b : "samantha", "type" : "DRINKS" }, "sumIntermediate" : 1, "count": 2, "drinks_count" : 1, "dates_count" : 0 } for example
[22:28:32] <TommyCox> yeah, dates_count and drinks_count always returns 0 for me
[22:28:34] <kida78> (the numbers may be off )
[22:30:13] <kida78> i know why
[22:30:18] <TommyCox> sup?
[22:31:02] <kida78> http://pastebin.com/yqLrjvFx
[22:31:15] <kida78> actually - scratch that
[22:32:12] <kida78> http://pastebin.com/jHfSQhm8
[22:32:17] <kida78> i had the row name wrong in the data
[22:32:23] <kida78> and the type wrong as well
[22:32:27] <kida78> was DATE should be DATES
[22:32:36] <kida78> and DRINK -> DRINKS respectively
[22:32:37] <TommyCox> lol, fingered it was something like that
[22:32:40] <TommyCox> figured*
[22:32:41] <kida78> so much for assembling data by hand
[22:32:50] <kida78> the aggregation works, though, despite the syntax here
[22:32:54] <TommyCox> usually never a good idea ;)
[22:33:02] <kida78> its the bottleneck i'm trying to figure out
[22:36:45] <novochar> what's the recommended method for storing json requests?
[22:37:11] <TommyCox> well, you wouldn't have to project and regroup if the dates and drinks were in separate collections.
[22:37:47] <TommyCox> how long does it take to do the initial $match, $group, $project?
[22:38:06] <kida78> for the full thing i've seen times of up to 30 seconds :(
[22:38:08] <novochar> my app has a json file that will be continuously updated
[22:38:17] <kida78> again 30m rows
[22:38:24] <kida78> but a,b is not an index
[22:38:24] <novochar> i guess the json file should be stored as a document
[22:38:29] <kida78> only a,count
[22:39:00] <kida78> i haven't tested with just the first 3 though
[22:39:15] <kida78> do you think the bottleneck is in the first or 2nd half?
[22:39:53] <TommyCox> well, running group twice is pretty taxing
[22:40:34] <kida78> i'm thinking of changing it to match, sort, group
[22:40:43] <sudobangbang> using mongoose, i can .find() an object in the database and in the callback print it out
[22:40:45] <sudobangbang> but i when i try to access one of it's properties ( it's obviously there ) it tells me it's undefined
[22:40:45] <kida78> followed by a 2nd sort maybe
[22:40:46] <sudobangbang> output http://dpaste.com/1137191/
[22:40:48] <sudobangbang> code producing output http://dpaste.com/1137174/
[22:40:49] <sudobangbang> ideas?
[22:41:02] <kida78> and then do the rest in java
[22:41:17] <kida78> so: match,sort,group,sort then assemble the rest in a hash
[22:41:27] <kida78> 80 rows of results at most?
[22:41:34] <kida78> can't be worse than what we're seeing here
[22:42:05] <kida78> if i do a match on a, then sort by B, wouldn't it make the group function faster?
[22:42:20] <TommyCox> That sounds like the way to go. While elegant, that query produces more overhead than needed i feel
[22:42:31] <kida78> so elegant
[22:43:32] <kida78> is there a relationship between the sort and the group?
[22:47:06] <TommyCox> Well, sort can benefit from an index before grouping, so theoretically it would improve performance
[22:47:29] <kida78> guess i gotta just give it a shot
[22:47:37] <kida78> thanks man
[22:47:42] <kida78> time to clear my local cache and do some tests
[22:49:31] <TommyCox> yeah, sorry i couldn't be of more assistance. If i had more time i'd do a little testing myself
[22:50:03] <kida78> no sweat man - this was helpful
[22:50:14] <TommyCox> this might help as well http://www.10gen.com/presentations/mongosv-2012/mongodb-performance-tuning
[22:51:43] <kida78> will check it out!
[23:07:11] <ruff> http://i.imgur.com/4IQ9maq.jpg
[23:07:32] <diegows> question, when you submit a .js to be execute with the mongoshell
[23:07:40] <diegows> is it executed in the server side, right?
[23:08:12] <diegows> I want to run batch process and I need performance, the amount of data is huge