PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 31st of October, 2012

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:41:39] <bakadesu> is it possible to export/remove a shard (say like for archiving documents older than a year)?
[00:46:19] <thesteve0> Question - I am getting an NPE when I try to save this DBObject to the collection - http://pastebin.com/ftY0sZ57
[00:46:53] <thesteve0> I am only filling in _id and description - is the NPE coming from the users DBObject being empty?
[01:06:42] <crudson> stack trace and what code you are executing?
[01:07:09] <crudson> I have to run out but that information would help anyone help you.
[01:24:48] <thesteve0> good call - stack trace … http://pastebin.com/vPenwTxB
[01:36:59] <crudson> should your containsKey() be returning null all the time?
[01:37:17] <crudson> been 5 years since I did java so certainly haven't done any mongo with it
[01:37:24] <crudson> but trying to see if anything seems obvious
[01:38:27] <crudson> and get() and keySet() and put() and containsField()?
[01:45:35] <thesteve0> crudson: yeah I will try that
[01:46:08] <crudson> I think there's an interface here that it's expecting you to honor.
[01:46:14] <crudson> :)
[01:46:24] <thesteve0> crudson: no it is "" which is not null
[01:49:02] <crudson> thesteve0: but your .put() is not doing anything, or even the other methods mentioned. When you give it a DBObject I'd expect it to use the methods on the DBObject interface to query the state of your object (with keyset() etc). Again I apologize if I misunderstand it.
[01:49:57] <thesteve0> crudson: which .put
[01:50:20] <crudson> thesteve0: clas MailList
[01:50:41] <crudson> you're implementing an interface but not implementing any of the methods
[01:50:51] <thesteve0> crudson: OH MY GOODNESS that is such an ID10T error
[01:51:01] <crudson> well they are there but all just return null and disregard the arguments given to them
[01:51:01] <thesteve0> crudson: I am so sorry
[01:51:04] <crudson> :)
[01:51:12] <crudson> oh we've all been there, don't worry
[01:52:01] <crudson> isn't there a base class you can subclass that does this all for free?
[01:52:11] <thesteve0> crudson: yeah I will look for that
[01:52:27] <thesteve0> crudson: no need to implement
[01:52:34] <thesteve0> crudson: good call
[01:54:31] <thesteve0> crudson: BasicDBObject does it
[01:55:02] <crudson> or just instantiate a concrete DBObject()? Depends on what your application wants to look like.
[01:55:04] <crudson> I gotta run
[03:07:35] <nvictor> hey
[03:10:46] <nvictor> i am trying to troubleshoot a mongodb server. everything seems to be setup correctly but not a single operation seems to affect it
[03:11:14] <nvictor> anyone has encountered this before ?
[04:20:05] <hdm> random queston on indexes; if an instance of mongod has multiple databases (call them A,B,C); if A is queried, the index is loaded to ram, then nothing happens and B/C are queried, will whatever ram used for A's index get freed up for other queries?
[04:20:28] <hdm> assuming yes, but seeing performance differences between querying A and not querying A before doing large queries on B
[05:12:39] <bobra> hi folks
[05:13:05] <bobra> I see a situtation where the storagesize is 3 times the datasize . any ideas
[05:29:47] <bobra> > db.feeds.dataSize()
[05:29:47] <bobra> 325064047036
[05:29:47] <bobra> > db.feeds.storageSize()
[05:29:47] <bobra> 934415398144
[05:29:47] <bobra> > db.feeds.totalIndexSize()
[05:29:48] <bobra> 684282144
[05:29:48] <bobra> > db.feeds.totalSize()
[05:29:49] <bobra> 935099680288
[06:41:06] <sent_hil> I understand mongo stores in BSON instead of JSON for efficiency, can someone explain to me why that is?
[06:50:30] <sirpengi> sent_hil: mongo stores in BSON because JSON doesn't allow binary data
[06:51:47] <sirpengi> BSON isn't any more space efficient than JSON is, but is built to be traversed faster
[06:52:17] <sent_hil> sirpengi: is there adv. to storing it in binary as opposed to json string?
[06:52:42] <sirpengi> like I said, if you had binary data, you can't use JSON
[06:53:08] <sirpengi> so then you'd have a db that cannot store binary data
[06:53:14] <sirpengi> which isn't all that useful
[06:55:06] <sent_hil> sirpengi: right...i meant is reading binary faster than reading json string?
[08:22:57] <sirpengi> sent_hil: no. but bson has other things that make traversing faster
[08:36:02] <[AD]Turbo> hola
[08:40:31] <NodeX> Ciao
[09:40:53] <_Mr_Sales> but /me is still here.
[10:00:11] <NodeX> eh
[10:00:39] <Zelest> :o
[12:19:50] <jtomasrl> when creating an array inside a collection, should i add an ID to each value in the array?
[12:20:43] <NodeX> if your app requires it then yes else no
[12:21:27] <jtomasrl> should i create a custom ID or just the mongodb objectID
[12:21:38] <NodeX> it's up to you
[12:21:51] <jtomasrl> kk thx
[12:21:56] <NodeX> should I drink coffee at lunchtime?
[12:22:02] <jtomasrl> na
[12:45:59] <wereHamster> NodeX: absolutely!
[12:46:07] <NodeX> :P
[13:11:46] <flex__> Hello. Is there some simple way to do set-if-not-set atomically, like SETNX from Redis? I see $exists, but this check doesn't appear to be atomic...
[13:16:17] <ron> flex__: have you looked at findAndModify?
[13:20:41] <IAD> =)
[13:21:17] <flex__> ron: not seen that, will look now, thanks! mongodb newbie, as it may be obvious ;-)
[13:21:38] <ron> flex__: no worries, we all start somewhere.
[13:23:13] <flex__> ron: Hm, not sure that's quite what I want. Whilst I can see that this solves half my problem, I don't see any atomic way to evaluate that the value is nonexistent between the find/set.
[13:23:44] <flex__> Oh, upsert?
[13:23:50] <ron> yup
[13:24:06] <flex__> Awesome. Thanks a million!
[13:54:54] <NodeX> flex_ : an upsert will work if you're not $inc the value
[13:55:39] <flux__> I'm not.
[13:56:35] <flux__> ron: Hi again. Sorry, I think I didn't make my problem clear enough. findAndModify works, but it also updates it if it exists. I'm only wanting to update if it doesn't exist.
[13:56:55] <socket> Hello, im looking for a too like phpmyadmin for mongodb? got one?
[13:56:57] <flux__> That is, if it exists, I don't want to do anything.
[13:57:00] <socket> tool*
[13:57:17] <ron> so you want to add a $not somewhere in the query? ;)
[13:57:29] <flux__> But doesn't that make it non-atomic?
[13:57:34] <NodeX> flux__ : an upsert is ... if exists update else insert
[13:57:42] <ron> findandmodify is atomic.
[13:58:10] <flux__> Oh, I see what you mean
[13:58:18] <flux__> Thanks again.
[13:58:21] <NodeX> ;)
[14:00:31] <NodeX> I dont think findandmodify is what you want
[14:00:38] <NodeX> because you dont want to modify it
[14:01:16] <ron> could be.
[14:01:59] <NodeX> I think it's a 2 query operation but I'd love to be proved wrong
[14:02:41] <Gargoyle> socket: Rockmongo
[14:02:54] <ron> rockmongo is.. hmpf.
[14:03:13] <Gargoyle> rockmongo is the best of a bad bunch at the mo!
[14:03:16] <ron> flux__: what exactly are you trying to do again?
[14:03:45] <ron> there's an eclipse plugin I like better than rockmongo, but I agree it's probably the better of most other evils.
[14:03:58] <ron> I really hate how it displays arrays.
[14:04:35] <Jb__> hello
[14:05:01] <Jb__> have you got any idea on how to check from a mongo driver
[14:05:11] <Jb__> that there is no pending inserts on server?
[14:05:22] <socket> so rockmongo is the best one but still sucks?
[14:05:28] <Jb__> e.g. I run a insert_batch on some client
[14:05:48] <Jb__> and count the number of entries of my collection on an other one
[14:05:59] <Jb__> once the insert_batch is completed?
[14:06:07] <Gargoyle> socket: Just use the mongo shell! :)
[14:07:00] <socket> :)
[14:10:28] <Gargoyle> socket: What is it you'll be mostly using it for?
[14:11:55] <Gargoyle> I use it for bits of dev work, quick queries, checking indexes. etc. Not really something I would rely on for making any serious changes (But then, I also stopped using phpMyAdmin about 10 years ago!)
[14:18:23] <Aric-> Can mongo do something similar to this: https://gist.github.com/04d8a40f68b6bdb132cc
[14:18:49] <Derick> you mean haversine?
[14:29:17] <NodeX> Aric : look at geospatial functions and the $geoNear
[14:34:18] <Aric-> http://www.mongodb.org/display/DOCS/Geospatial+Indexing ?
[14:34:26] <Aric-> looks promising
[14:40:01] <NodeX> there are some caveats with it though
[14:41:32] <Aric-> namely?
[14:44:38] <NodeX> ordering by distance is the biggest
[14:56:29] <Aric-> :(
[14:56:49] <Aric-> Maybe I'll store this data in MySQL for now and use node-mysql
[14:57:14] <Derick> NodeX: what do you mean, you can order by distance - it's even the default
[15:01:53] <Aric-> hmmm
[15:01:57] <Aric-> i was just reading that
[15:04:37] <NodeX> Derick : no you cant - not the last time I checked anyway
[15:04:58] <NodeX> the default $near command orders by distance but no other geospatial operation does
[15:05:07] <Derick> NodeX: heh? $near sorts by distance, and the geoNear command returns distance as well
[15:05:17] <Derick> $within probably doesn't, right
[15:05:37] <NodeX> as I just said ... No
[15:06:03] <NodeX> only "$near / $geoNear" do
[15:06:15] <Derick> but it makes little sense with $within though
[15:06:25] <NodeX> LOL how come?
[15:06:37] <NodeX> within 5 miles - I still want the closest
[15:06:39] <NodeX> (first)
[15:06:47] <NodeX> or at elast the choice of what comes first
[15:06:51] <NodeX> least*
[15:06:53] <Derick> closest to what?
[15:06:58] <NodeX> closet to my point
[15:07:07] <NodeX> x,y
[15:07:12] <Derick> but you don't give a *point* for a $within query
[15:07:17] <Derick> just a bounding box
[15:07:47] <NodeX> db.collection.find( { location: { $within: { $circle: [ center, radius } } } );
[15:07:56] <NodeX> you can use a bounding box or a point
[15:07:58] <Derick> ah, the circle one, yes
[15:08:10] <Derick> hmm, for that one it'd make sense
[15:08:19] <Derick> less so for $polygon and $box though
[15:08:28] <NodeX> db.collection.find( { location: { $within: { $center: [ [0,0], 10 } } } );
[15:08:33] <NodeX> so it's 50/50 tie
[15:08:50] <NodeX> it's a let down that it has no option to sort and or return distance
[15:09:02] <NodeX> but I am sure it's coming in future versions ;)
[15:09:11] <Derick> maybe, it's really tricky to make an index for it
[15:09:17] <NodeX> (again some queries do return distance)
[15:09:26] <NodeX> I think it is really tricky
[15:09:42] <NodeX> I requested it about v 1.6 or shortly after it came out
[15:09:47] <NodeX> 1.8 or whatever
[15:10:00] <NodeX> from what I gather it uses geo hashes
[15:11:32] <NodeX> it's no biggie for most operations because most people use $near anyway, - the one large caveat with near is the results are limitted to 5000 or somehting
[15:12:03] <Derick> hmm, really?
[15:12:06] <Derick> i should test that
[15:12:54] <ron> Derick: topic should be updated..
[15:13:05] <NodeX> it might have been raised in recent verssions but it's deffo capped
[15:13:12] <NodeX> deffo -> definately
[15:13:22] <NodeX> (a momentary lapse to scouse then)
[15:13:32] <Derick> ron: good point
[15:14:10] <NodeX> \o/
[15:14:17] <ron> \o/
[15:14:49] <Gargoyle> I thought near only returned the forst 100 results?
[15:15:19] <NodeX> it's capped, I can't remember the number
[15:15:26] <Gargoyle> Oh great! Mongo has lost count again!
[15:15:46] <Gargoyle> "Processing 135445 of 133043...
[15:16:10] <NodeX> lmao
[15:16:17] <NodeX> I thought it was your code Gargoyle ?
[15:16:24] <NodeX> or was that someone else told me that
[15:16:55] <Gargoyle> Just refreshed on rock mongo, and the count for the collection is 133043
[15:17:34] <Gargoyle> I wonder if this might have something to do with things being relocated on save()
[15:19:16] <NodeX> it's safe writes
[15:19:17] <NodeX> ?
[15:20:00] <Gargoyle> yup
[15:20:29] <NodeX> it is strange, mine doesn't do it
[15:22:07] <Gargoyle> It's not consistent, becuase when I ran it on a smaller script from the other day, I couldn't get it to repeat the misscount. But this is a large batch job resizing jpegs, so I suspect there is a lot more internal shuffling going on.
[15:22:51] <Gargoyle> just wondering if there is the possibility of it getting stuck in an infinate loop!
[15:23:15] <NodeX> i'm about to resize 200k jpegs so I'll add a counter and test on mine
[15:23:39] <Gargoyle> What are you using to resize?
[15:24:55] <NodeX> php script probably
[15:25:06] <NodeX> gd library
[15:25:25] <Gargoyle> NodeX: This one is Imagick based.
[15:25:41] <NodeX> I dont think it will make a difference tbh
[15:25:53] <NodeX> unless your script is threading
[15:26:05] <Gargoyle> nope.
[15:26:42] <Gargoyle> You think using a $set would make much difference when saving this kind of thing?
[15:26:45] <Infin1ty> I have 4 nodes + 1 arbiter replicaset, 3 nodes + 1 arbiter are in one DC, the 4th node is in other DC, what happens if i lose the 4th node and then take the 3rd node down as well? will there be any problems with primary election?
[15:27:35] <Gargoyle> Infin1ty: Primary elections need a majority. I think it's as simple as that.
[15:30:17] <Infin1ty> Gargoyle, hmm, so if i have now 3 nodes + 1 arbiter (1 node is down) and i'm taking another node down, i have 2 nodes + 1 arbiter, i think i'm good, no
[15:30:17] <Infin1ty> ?
[15:30:53] <Gargoyle> 2+1 = 3, 3 from an original rs of 5 = majority. You should be fine.
[15:38:33] <Infin1ty> Gargoyle, thanks
[15:44:13] <Nicolas_Leonidas> I've created a collection called db.stats.largedaily
[15:44:33] <Nicolas_Leonidas> with php but when I do db.stats.largedaily.count() in mongo shell, it says TypeError: db.stats.largedaily has no properties (shell):1
[15:44:38] <Nicolas_Leonidas> why is that?
[15:45:06] <NodeX> show collections
[15:45:49] <NodeX> and make sure you've selected the correct db
[15:46:24] <NodeX> get a job you bum
[15:46:26] <NodeX> :P
[15:47:19] <Gargoyle> Nicolas_Leonidas: Pastebin some code & command input/output
[15:47:41] <Nicolas_Leonidas> my mongo has crashed, because I tried to add an index to a gigantic table
[15:47:54] <ron> doubtful. mongo doesn't have tables.
[15:47:55] <Nicolas_Leonidas> I'm trying to restart the service, it didn't work now I'm trying to restat linux
[15:48:04] <Nicolas_Leonidas> collection I mean
[15:48:40] <Gargoyle> Nicolas_Leonidas: Pastebin some flavours and versions!
[15:49:04] <Nicolas_Leonidas> MongoDB shell version: 2.2.1
[15:52:24] <Nicolas_Leonidas> This project I'm working on is about recording daily stats about events happening on the website, such as user clicks, page views and stuff, there will be around 100,000,000 documents per year
[15:52:33] <Nicolas_Leonidas> do you think I should be using mongodb for this?
[15:53:22] <Gargoyle> Nicolas_Leonidas: deffo! mongo is great for "stuff" :-)
[15:54:11] <Nicolas_Leonidas> ok, so I restarted the server, here are "show collections"
[15:54:12] <Nicolas_Leonidas> http://pastebin.com/R6V6CKMi
[15:54:35] <NodeX> db.largedaily.count();
[15:54:36] <NodeX> ;)
[15:54:50] <Nicolas_Leonidas> NodeX: yeah that works now, didn't work before because I interrupted ensureIndex
[15:54:54] <NodeX> you have created that collection in the default database - you do realise that?
[15:55:08] <NodeX> sorry my mistake
[15:55:16] <NodeX> I erad "test" not stats lol
[15:55:20] <NodeX> read*
[15:56:00] <NodeX> it also didnt work because you issued the command wrong
[15:56:01] <Nicolas_Leonidas> I have a question about compound indexes, I want 5 fields to be indexed, should I use ensureIndex on each separately or in one shot?
[15:56:16] <NodeX> it's db.COLLECTION.count() not db.DATABASE.COLLECTION.count9)
[15:56:29] <Nicolas_Leonidas> NodeX: right, I get it now
[15:56:49] <Gargoyle> NodeX: You got some diswexic fingwrs today!
[16:01:01] <Nicolas_Leonidas> so, db.largedaily.ensureIndex({year:1, month:1, day:1, lid:1, type:1 }) is the same as db.largedaily.ensureIndex({year:1}); db.largedaily.ensureIndex({month:1}) and ... ?
[16:01:25] <Gargoyle> Nicolas_Leonidas: no.
[16:02:10] <hdm> Nicolas_Leonidas: compound indexes only work when you query the fields in specific order
[16:02:14] <Nicolas_Leonidas> anyone?!
[16:02:22] <hdm> the docs cover it pretty well
[16:02:28] <Nicolas_Leonidas> hdm, I see
[16:02:41] <hdm> if you query against month/da/lid/type, but NOT year, the compound index wont be used
[16:02:57] <hdm> however if you query year, or year+day, or year+day+lid, etc, it will work
[16:03:22] <Nicolas_Leonidas> hdm: unless hinted explicitly like the docs say right?
[16:03:36] <hdm> thats what they say, but i didnt have much luck, even with hints
[16:03:51] <hdm> maybe i did it wrong, but unless i queried in the specific order, it wouldnt use the index
[16:04:14] <hdm> actually, ive got an example now i can test with, sec
[16:04:33] <Nicolas_Leonidas> how do you know if it's using the index or not? is there something like "explain" in mysql?
[16:04:53] <Gargoyle> Nicolas_Leonidas: yes… explain()
[16:05:17] <Gargoyle> Nicolas_Leonidas: Have you read any docs?
[16:05:21] <hdm> Nicolas_Leonidas: and youre right, v1.6+ says it will use them w/hints, trying to figure out why it didnt work here
[16:05:24] <hdm> http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeys
[16:05:41] <Nicolas_Leonidas> brb
[16:06:03] <Nicolas_Leonidas> Gargoyle: yeah I read a bunch
[16:06:13] <Nicolas_Leonidas> but today is my second day of mongo
[16:11:21] <hdm> hrm, cant seem to get hint() to use a specific sub-key of _id
[16:12:04] <Aric-> how would you use $near and friends in MiniMongo?
[16:12:06] <hdm> index is => _id : { ip : 1, port : 1 }, hint is .hint({ "_id" : 1 })
[16:12:10] <tomreyn> hi, i need to upgrade mongodb from v1.6 all the way to 2.2.1. can i do this in a single step?
[16:12:32] <hdm> tomreyn: better off doing a full mongodump and then mongorestore into 2.2.1
[16:12:45] <hdm> id suggest running mongod with --objcheck too
[16:13:21] <tomreyn> hdm: the old or the new one with --objcheck, or both?
[16:13:29] <xcat> I'm getting MongoCursorException in PHP since upgrading from 2.2.0 to 2.2.1... is this normal?
[16:14:39] <hdm> tomreyn: new
[16:14:49] <tomreyn> but just once after restoring the DBs, right?
[16:15:00] <hdm> yeah, but im paranoid and run production with --objcheck
[16:15:13] <hdm> i had off and on db corruption for 4 months until i did so, drove me crazy
[16:15:22] <tomreyn> does this not impact performance badly?
[16:15:24] <hdm> ended up being a bad ram stick on the *client*
[16:15:32] <tomreyn> ouch
[16:15:39] <hdm> not that ive noticed, im i/o bound, not cpu bound on inserts/updates
[16:15:56] <hdm> the ugly part is the corruption happened in a bson subdocument, so it took forever to figure out where/how
[16:16:19] <hdm> being religious about objcheck has prevented it from happening again, mongo doesnt otherwise validate BSON structure on insert from clients
[16:16:29] <tomreyn> i wouldnt even know where to start, i'm all new to mongodb
[16:16:54] <tomreyn> so thanks for this hint, that's really good to know.
[16:16:59] <hdm> you can turn it off and run without it if you feel its a performance hit, i havent noticed it thhough
[16:17:13] <hdm> for the initial import of 1.6 i would definitely do it though
[16:17:19] <hdm> just in case something got mangled
[16:17:42] <tomreyn> are you running replicasets with --objcheck in production?
[16:18:03] <tomreyn> i'm wondering whether it's noticeable overhead there
[16:18:11] <hdm> not even rs's right now, just single nodes with backups every 24h, i can always rebuild, but with objcheck
[16:18:37] <skot> It is fairly low overhead and just extra cpu (not usually a limiting resource)
[16:18:39] <hdm> ive got a ton of data but only one user, so a different use case than most
[16:18:56] <hdm> ~3.7T / 1.5 billion records, single server
[16:18:58] <tomreyn> hehe, i can bet what that data is
[16:18:59] <hdm> has been a fun challenge
[16:19:03] <hdm> yeah :)
[16:19:29] <hdm> having to rework it all now to use a DB per month since the index size is over 200G
[16:19:50] <hdm> ssd array capped out at 1T
[16:20:40] <IAD> looks hard
[16:21:41] <tomreyn> that's quite an index
[16:23:08] <NodeX> I have 1kb of data and 7 users, I am worried about scaling
[16:23:26] <NodeX> my atari 512 is whirring
[16:23:46] <Gargoyle> NodeX: Can't belive you are wasting your bytes on IRC!
[16:24:08] <NodeX> I know right
[16:24:09] <Gargoyle> NodeX: If you stop typing, you can support 2 more users!
[16:24:14] <NodeX> k
[16:24:25] <NodeX> but then I cannot troll :/
[16:24:53] <hdm> lol
[16:24:57] <NodeX> 5 days 7 hours, 37 mins
[16:25:51] <Gargoyle> NodeX: In that case, I would limit to 5 users so you can save your bandwidth for when MongoIdiot comes back! ;P
[16:26:08] <NodeX> yer
[16:32:58] <xcat> Can I go back to 2.2.0 using Debian package manager?
[17:14:09] <tomreyn> Since there are both mongodump and bsondump binaries, do i need to run both to get a complete dump,or is mongodump sufficient?
[17:29:32] <jrdn> lol @ NodeX
[17:29:49] <jrdn> you're just a silly billy
[17:35:44] <hdm> anyone familiar with how to combine two fields into a single field in a $project and then $group?
[17:36:29] <hdm> seem to be missing something obvious here: '$project' => { 'stamp' => { 'year' => { '$year' => '$created_at' }, 'day' => { '$dayOfMonth' => '$created_at' } }}, '$group' => { '_id' => '$stamp', 'count' => { '$sum' => 1 } }
[17:36:52] <hdm> was hoping to set _id to be { year, day of month } and then group on it with a counter
[17:47:25] <sander__> Do anyone deliver mongodb as a service?
[17:47:39] <kali> sander__: mongohq
[17:50:50] <sander__> kali, does it run a webserver also?
[17:52:20] <sander__> kali, and is it rendundant with several datacenters?
[17:52:41] <kali> no idea :)
[17:56:59] <sander__> kali, do you know how mongodb handles upgrades? will it be backward compatible?
[17:58:22] <hdm> still missing something obvious with $project/$group, anyone have ideas? http://pastie.org/private/cu84vjuphbuvfukfn7lqua
[18:00:49] <kali> sander__: you need to check out the changelogs. some downgrades are not possible
[18:01:56] <sander__> kali, I don
[18:02:27] <sander__> I don't want to downgrade.. I want to be sure my current code works on future versions of mongodb
[18:03:16] <sander__> kali, In case i'm running mongodb as a service.. then it will be very bad if they decided to upgrade mongodb witout it beeing compatible.
[18:03:58] <sander__> So just wondring how that's solved.
[18:06:45] <kali> sander__: the intent in clearly to be compatible to allow most people to upgrade as soon as possible. that said, there are often a few corner cases where you need to adjust your code before upgrading
[18:15:18] <sander__> kali, do you have a good document with an introduction to mongodb?
[19:12:11] <hell_razer> hello i am unsing mongo from official centos repo, i can not restart it, its doenst release console at /etc/init.d/centos restart/stop/start
[19:25:07] <jrdn> i tend to shorten field names, is there any way in mongo do to a similar thing as mysql's AS to rename a field? (in my rest app, i don't want to show shortened names)
[19:25:32] <W0rmDrink> ehrm
[19:25:34] <W0rmDrink> ;(
[19:26:15] <jrdn> currently i'm have domain models that i'm passing to the view with the right field names, but this can be unneccesary overhead if i'm just doing a find({}) with no more manipulation ;(
[19:26:27] <W0rmDrink> echo 'db.sms.insert( { "smpp_info" : { "method" : "deliver_sm", "source_addr_ton" : 1, "source_addr_npi" : 1, "source_addr" : "923012401656", "dest_addr_ton" : 4, "dest_addr_npi" : 9, "dest_addr" : "550", "req_datetime" : ISODate("2012-10-31T12:25:02Z"), "req_sequence_number" : 1656, "encoding" : 0, "req_system_id" : "smppclient1", "req_smsc_host" : "127.0.0.1", "req_smsc_port" : 10000, "req_short_message" : "" }, "gw_info" : { "int_transaction_
[19:26:27] <W0rmDrink> id" : "201210311401656", "int_timestamp" : ISODate("2012-10-31T12:25:02Z"), "message_id" : "201310311401656", "state" : "received", "origin" : "smsc" } } );' | mongo localhost:27017/sms
[19:26:30] <W0rmDrink> ehrm
[19:26:31] <W0rmDrink> fail
[19:27:06] <kali> jrdn: some ODMs will do that for you
[19:27:22] <jrdn> kali, i kno
[19:27:22] <W0rmDrink> if I run this: http://pastebin.com/xzXbRGLE - the resulting types of "source_addr_ton" : 1, "source_addr_npi" : 1, is numberDouble
[19:27:25] <jrdn> +w
[19:27:30] <W0rmDrink> why is this ?
[19:27:57] <kali> WormDrink: why don't you show us the error message ?
[19:29:52] <W0rmDrink> kali, no error msg - here is key and type dumps: http://paste2.org/p/2408888
[19:30:26] <W0rmDrink> type for source_addr_npi and source_addr_ton is 1 - which is NumberDouble=1
[19:30:36] <W0rmDrink> I want this to be NumberLong
[19:30:56] <W0rmDrink> nvm
[19:30:58] <kali> you need to warp them in NumberLong() then
[19:31:01] <kali> wrap
[19:31:07] <W0rmDrink> http://www.mongodb.org/display/DOCS/Data+Types+and+Conventions
[19:31:08] <W0rmDrink> yes
[19:31:09] <W0rmDrink> sorry
[19:31:53] <kali> that's because JS has no type
[19:43:14] <Bilge> Can I downgrade to 2.2.0?
[19:45:39] <kali> from what ?
[20:19:20] <Xerosigma> Is there any documentation on setting up replication on Windows? Google is failing me.
[20:20:04] <wereHamster> Xerosigma: have you searched 'mongodb replication'?
[20:20:25] <wereHamster> replication is the same under any operating system, it's no different under windows than it is under linux
[20:21:16] <Xerosigma> I tried to use this for reference: http://docs.mongodb.org/manual/reference/configuration-options/
[20:21:29] <Xerosigma> However, it isn't really working out. xD
[20:22:49] <Xerosigma> I've also reviewed this: http://docs.mongodb.org/manual/tutorial/deploy-replica-set/
[20:24:32] <Xerosigma> Hmmm...perhaps it's the "Production" section that's confusing me.
[20:25:33] <Xerosigma> I'll start with the development set and work up then. Looks descriptive. Thank you.
[20:28:59] <wereHamster> "isn't really working out" is as useful as ... a pile of poo
[21:26:22] <fommil> Hi all – I'd like to be able to pass JSON directly to MongoDB as inserts (and queries) and to receive JSON in response using the Java driver. Is this possible?
[21:30:43] <nicobn> if I'm using sharding, is it right that I should stop specifying the replica set I want to use when I connect to the mongo server using a driver ?
[21:33:19] <_m> fommil: (with the 2.0 driver) Use com.mongodb.util.JSON
[21:33:35] <_m> EG: dbColl.save(JSON.parse("{'name':'value'}");
[21:33:42] <fommil> _m: interesting, I'll have a look.
[21:35:46] <fommil> _m: you mean DBCollection.save(DBObject) ?
[21:36:34] <fommil> _m: I actually already have the JSON marshalling sorted, I just want to be able to pass and receive JSON during inserting/reading
[21:37:17] <_m> In what sense? Serializing a JSON object as a field or using JSON as your query?
[21:37:56] <fommil> _m: JSON.parse returns an Object – I have no idea what that is. DBCollection.save takes in a DBObject.
[21:38:31] <_m> I would imagine the docs for the JSON class provide information about said object.
[21:39:00] <_m> class/module/whatever term Java uses
[21:39:07] <fommil> _m: I have an object, I already have code that can serialise/deserialise to a JSON String. I want to be able to pass that String into MongoDB to insert the object into the DB, and when I read rows, I want JSON to be returned.
[21:39:53] <_m> http://www.mkyong.com/mongodb/java-mongodb-convert-json-data-to-dbobject/
[21:39:54] <_m> Google.
[21:40:22] <fommil> _m: so I'm passing `String` in for CREATE and UPDATE, and I'm getting `String` out for the READ.
[21:40:50] <fommil> _m: right, that is totally not obvious from the Javadocs. Why the hell is the signature not DBObject?
[21:42:04] <fommil> _m: but in any case, this is still not optimal – I'd really like to be able to pass the JSON `String` directly to MongoDB so that there is not an intermediary layer of translation happening. In the console, isn't the driver just converting this back into a JSON string again?
[21:44:00] <ron> no. mongo doesn't store JSON, it stores BSON.
[21:44:08] <_m> Correct.
[21:45:45] <fommil> ron: whether it's JSON or BSON, using JSON.parse to get a DBObject, which is then converted into a String (J|B)SON when talking to MongoDB is inefficient
[21:46:51] <ron> BSON isn't a string. As for being converted to JSON, you don't know that it does that. As for efficiency, do you suffer any performance issues that you're trying to solve?
[21:48:03] <fommil> ron: yeah, performance really matters – I don't want to take stages that aren't needed. If there is a method in the API that takes raw JSON Strings, then that's perfect. If it doesn't exist, I'll profile and look at my options.
[21:48:35] <fommil> ron: well all my objects are made up of primitives that mean the JSON and BSON are equivalent.
[21:48:39] <ron> I didn't say performance does't matter. I asked whether you actually have any performance issues at the moment.
[21:49:06] <fommil> ron: I've not written it yet – so I want to use the right API the first time.
[21:49:26] <ron> do you write your code in a way that completely avoids autoboxing too?
[21:50:23] <_m> You can look at the code for the driver to see if what you're attempting is supported and simply not/poorly documented.
[21:50:54] <fommil> _m: well, thanks for the pointers to util.JSON. At least that's given me a way of avoiding writing the explicit CRUDs, even though it's not exactly what I was after. Now I can convert String <-> DBObject, which is useful
[21:51:20] <_m> https://github.com/mongodb/mongo-java-driver
[21:51:24] <fommil> _m: maybe direct String JSON writing isn't supported.
[21:52:24] <fommil> _m: I've already got the code and looking through it. It's not got the best documentation in the world – the DBOject cast on JSON.parse is a case in point. I don't see why that doesn't just return DBObject.
[21:52:34] <_m> You're welcome.
[21:53:00] <_m> What are the implications of parsing/encoding the string to a dbobject? Does that really cause Java to DIAF?
[21:53:55] <fommil> _m: hehe, well the app is about really high throughput JSON -> DB conversion. The REST -> JSON marshalling is super optimised, and I wince at the thought of an extra String -> DBoject -> JSON marshalling layer
[21:54:21] <fommil> _m: I'll have to profile to see if it's going to be a big problem, and if it is I'll deal with it then. Premature optimisation and all that
[21:54:49] <ron> fommil: you're in the US?
[21:54:55] <fommil> ron: no
[21:55:08] <ron> hmm.
[21:55:20] <fommil> ron: why does that matter?
[21:55:37] <ron> just wanna make sure I never get the chance to hire you :)
[21:55:46] <fommil> ron: you couldn't afford me
[21:55:59] <ron> you'd be surprised ;)
[21:56:23] <fommil> ron: and I'd never work for you – you've turned a very sensible conversation into a childish troll
[21:56:55] <ron> _nothing_ in that conversation was sensible.
[21:57:21] <fommil> ron: whatever… go back to your bridge
[21:57:33] <ron> heh, poor soul :)
[21:59:18] <skot> fommil: there is no prebuilt thing that you want, but you can take a look at json.parse and the callback interfaces and go directly from string (json) to encoded bson (create a lazydbobject from bytes) and insert that, on the way out you can use a custom decoder as well. But the whole driver is made to produce DBObjects, basically.
[22:00:31] <skot> the lazy* classes are essentially byte[] holders which implement the DBObject interface
[22:44:21] <mrpro> looks like the more connections the less throughput
[22:44:22] <mrpro> thats wack
[23:09:14] <cornchips1> i would like to run mongo on top of dfs so i don't have to deal with sharding and so my dfs could take care of replication. would like to have multiple mongo servers as writers/readers.. any ideas if/how this can be done
[23:20:26] <jcims> this is going to be a terrible question from a complete n00b to nosql. i am aggregating software inventory information from approximately six different sources and am considering the use of mongodb as the repository. the different sources have different formats for the same data, and different confidence levels. generally speaking, would it be better to invest time normalizing the data up front, or getting the data into mongo as is and
[23:20:37] <jcims> probaby a million records total