PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 1st of May, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:02:15] <frodo_baggins> Hmm, Okay, here's another query I ran... https://gist.github.com/blafreniere/b16b78dc9824e35771f8
[00:02:53] <frodo_baggins> oh.
[00:02:55] <frodo_baggins> I'm a dingus.
[00:02:57] <frodo_baggins> :D
[00:09:35] <frodo_baggins> Should I use the C++ BSON extension or the pure JS version?
[00:09:39] <frodo_baggins> I'm guessing C++.
[00:12:19] <frodo_baggins> It looks like I might need to install build-essential.
[00:14:25] <frodo_baggins> Yay, that fixed it.
[00:18:57] <moleWork> how does one deal with: {"err":"connection to [<servername>] timed out"} errors?
[00:19:08] <moleWork> it happens every time socketTimeoutMS happens
[00:37:50] <moleWork> ahh i get it... the weird err object is a raw getLastError() result
[01:02:04] <frodo_baggins> So, it looks like my update call is working, but I need it to return the updated or inserted document.
[01:02:40] <frodo_baggins> If possible.
[01:02:48] <frodo_baggins> If not, I guess I'll just do a find. :D
[01:03:35] <frodo_baggins> But, it seemed that previously, I was able to have the result callback parameter be set to the document that was being updated, the complete document, so, if there's an option I can set to have that functionality, that would be awesome.
[01:03:51] <frodo_baggins> In the meantime, it seems that result is returning just a number.
[01:04:12] <frodo_baggins> I swear it returned a complete document before.
[01:07:31] <frodo_baggins> Ah, it appears I should use findAndModify.
[01:10:47] <moleWork> mongodb driver is so so so weird
[01:12:27] <moleWork> it gives me an error on an insert {"err":"connection to [servername:27017] timed out"}
[01:12:27] <moleWork> so I've added retrylogic thinking the writeconcern meant that it didn't write to disk..... but it did write to disk cause the retry logic is getting duplicate key errors now so i'm not sure how to tell if something was written to disk or not... it most certainly isn't if(!err) on the insert callback
[01:14:22] <frodo_baggins> Hmm, interesting.
[01:14:35] <frodo_baggins> So it looks like the github documentation is more current than the website documentation...
[01:16:14] <moleWork> i wonder if this is valid logic
[01:16:25] <moleWork> collection.insert(body.data, {w: 1}, function(err, result) {
[01:16:25] <moleWork> if(err) {
[01:16:25] <moleWork> if(err.err && !err.err.code) { //write was probably still good.... who knows?
[01:17:25] <frodo_baggins> Oh, nevermind.
[01:17:32] <frodo_baggins> :D
[01:18:21] <frodo_baggins> Apparently it's node-mongodb-native that I need to read.
[01:19:06] <moleWork> hehe
[01:19:14] <moleWork> i've been knee deep in that documentation for a month now
[01:19:22] <moleWork> doesn't help you make a stable app, i swear
[01:19:40] <moleWork> the devil is in the details
[01:20:55] <frodo_baggins> I wish the node-mongodb-native driver API more closely corresponded to MongoDB's API.
[01:21:02] <frodo_baggins> :(
[01:23:19] <moleWork> Disconnects can happen from time to time even without an aggressive firewall setup. Before you get into production you want to be sure to handle them correctly.
[01:23:32] <moleWork> not sure how to handle them correctly is what my problem is
[01:24:05] <moleWork> i'm guessing at logic as to what happenned when i get a timeout error
[01:27:00] <frodo_baggins> Can I not use $inc and $setOnInsert in the same query?
[01:27:47] <frodo_baggins> I have $inc incrementing a field called hitCount, and I have $setOnInsert initializing hitCount to 0 if it's not inserted.
[01:28:05] <frodo_baggins> Or I should say, if it doesn't exist.
[01:28:23] <moleWork> no idea, but good question
[01:28:41] <frodo_baggins> I'm getting: MongoError: Cannot update 'hitCount' and 'hitCount' at the same time
[01:29:20] <moleWork> probably do $inc: { field:1} which, if it is undefined, will set it to 1)
[01:29:31] <frodo_baggins> Ah, okay, awesome.
[01:29:34] <moleWork> not sure if you need setoninsert at all
[01:29:38] <moleWork> http://docs.mongodb.org/manual/reference/operator/update/inc/
[01:29:47] <moleWork> i haven't tried it, it's just what the doc says
[01:58:09] <moleWork> i think i found some simple logic to work around the issue, but it's like... umm... pretty shady
[02:00:11] <moleWork> http://jsbin.com/ruvuwizi/1/edit
[02:01:47] <moleWork> this can't be the right logic for all situations but fixed my problem... basically result is not set, i get an err.err: " [servername:27017] timed out" but doc._id is set and the document is indeed written to the database
[03:15:41] <stratos13_> hey guys having a little problem here... I'm calling mongoDB with and the data I get back is like this: { year: 2005, VIN: 18048124, make: &#39;Toyota&#39;, model: &#39;Corolla&#39;, price: 123, ... etc
[03:16:09] <stratos13_> how do I get it to omit the &#39 (apostrophe) for the make and model variables
[03:16:42] <cheeser> calling it how?
[03:24:34] <stratos13_> nvm got it
[03:24:47] <stratos13_> JSON.stringify to the rescue
[07:22:01] <sobersabre> hi.
[07:22:14] <sobersabre> I'm using python client to connect to a mongodb.
[07:22:57] <sobersabre> when I'm dropping a collection, do all its indexes get dropped as well, or do I have to run collection.drop_indexes() before dropping the collection ?
[09:32:04] <ranman> sobersabre the indexes are dropped as well
[09:33:31] <ranman> joannac are you alive?
[10:00:24] <joannac> ranman: um, yes?
[10:00:30] <ranman> hooray
[10:00:34] <ranman> happy winter
[10:01:00] <joannac> happy summer!
[10:01:30] <ranman> goodnight!
[10:04:53] <mylord> on mac, i get unknown user mongodb when trying this: sudo -u mongodb mongod --repair --dbpath /data/db/mongodb/
[10:05:08] <mylord> what user is used typical installation?
[10:05:19] <ranman> mylord: on OSX how did you install mongodb?
[10:05:33] <ranman> both that datapath and command structure are atypical of osx
[10:05:42] <mylord> trying to remember.. maybe port
[10:06:52] <mylord> how can i check?
[10:07:02] <ranman> I mean are you sure your data is at that path?
[10:07:20] <ranman> you could run: ls -la /data/db/mongodb to figure out the user
[10:07:30] <ranman> then run repair database as that user
[10:07:41] <ranman> for the most up to date mongodb on OSX I really recommend homebrew
[10:08:15] <mylord> ya, i might have used brew.. looks like its owned by me.. -rwxr-xr-x 1 rover wheel 5 Apr 2 16:55 /data/db/mongod.lock
[10:08:20] <mylord> is that ok?
[10:08:38] <ranman> brew doesn't install into /data/db
[10:08:59] <ranman> but yeah you should in that case just be able to run it without the sudo
[10:09:25] <ranman> brew typically sets the datapath to $BREW_PREFIX/var/mongodb/
[10:09:46] <mylord> i get this: http://hastebin.com/owitiyusiz.mel
[10:10:15] <ranman> take away the mongodb part
[10:10:39] <ranman> what are you trying to do? why are you trying to repair?
[10:12:40] <rspijker> normal user is mongod not mongodb
[10:12:50] <ranman> rspijker: osx
[10:17:26] <rspijker> ranman: I use OSX myself, never realized brew didn't install it under it's own user
[10:18:00] <ranman> rspijker: not the brew way, brew tries to do as much as possible without modifying the system
[10:18:47] <ranman> brew edit mongodb will show you the formula
[10:18:49] <ranman> it's kind of cool!
[10:19:02] <ranman> https://github.com/Homebrew/homebrew/blob/master/Library/Formula/mongodb.rb
[13:01:15] <asturel_> anyone knows which package should i install on debian to have libmongoclient.so?
[13:03:41] <asturel_> mongodb-dev: /usr/lib/libmongoclient.a
[13:47:41] <Aswebbb> Hello guys
[13:47:48] <Aswebbb> how can I put a password on my mongodb ?
[13:48:45] <koc> first in unauthenticated mode,
[13:48:51] <koc> >use admin
[13:49:01] <koc> >db.adduser("name","psw")
[13:49:12] <koc> quit monog shell
[13:49:30] <koc> restart your mongod instance in auth mode
[13:49:36] <cheeser> Aswebbb: http://docs.mongodb.org/manual/core/security/
[13:50:02] <koc> tpype mongo, go to db 'admin' and use db.auth() command
[13:50:04] <koc> that is it
[14:01:03] <iphands> hey, I am starting a project where I hope to use mongo -> sleepy/drowsy -> AngularJS ... but I have some questions about where document level ACLs should be implemented
[14:01:14] <iphands> can anyone here offer advice regarding this?
[14:01:54] <iphands> I suspect that I want to have mongo -> sleepy/drowsy -> some light layer to enforce document query restriction -> angular
[14:02:48] <iphands> but I wonder if sleepy or drowsy have already solved that by letting you "plug in" your own ACL "business logic"
[14:02:55] <Nodex> you will need to do this in yur app
[14:07:01] <iphands> Nodex: so you would put an application in between sleepy or drowsy
[14:08:38] <Nodex> I don't know what they are sorry
[14:09:53] <cheeser> 2 of the 7 dwarves?
[14:10:46] <q85> iphands: this channel doesn't seem like the right place for your question.
[14:11:56] <Nodex> LOL at dwarves
[14:20:03] <iphands> q85: works for me
[15:00:53] <Froobly> hi, i'm using another nosql db that has no way of renaming indexes within documents. i'm trying to rename a slug index for nicer routing. in one location i have a flat list of large objects in another document. when "renaming", i copy to the new index, and i create an alias { aliasOf: 'new-slug' } at the old one so that routing forwards with the old url. now rather than copy/delete the big tree of data, i was thinking about creat
[15:00:53] <Froobly> ing aliases for these in reverse, so that the new slug points to a new tree which is really an alias to the old tree. does anyone foresee any problems with this approach?
[15:47:30] <hallas> Yo! I have a question!
[15:48:04] <hallas> I have an aggregate pipeline that works awesomely. But! I would like to know if I can somehow combine the query it self an the explain option without running the query twice.
[15:48:34] <hallas> I wonna have the resulting documents, but also know how much I could get potentially (I have a $limit and $skip in my query)
[15:48:55] <hallas> So I can have pagination but also know how many pages there are in total. Can I do this without two seperate queries?
[16:21:39] <q85> hallas: no, adding explain to the query returns the explain document (even though it executes the query to generate the explain).
[16:21:47] <hallas> yeah..
[16:21:53] <hallas> just seems dumb to do two queries :)
[16:21:57] <hallas> but thats what I ended up with
[17:35:31] <bobbytek> Anyone know how to install a specific version of mongodb with brew?
[17:35:42] <bobbytek> I can only seem to find the latest
[17:50:31] <ehershey> bobbytek: brew versions mongodb
[17:50:58] <bobbytek> Figured it out: http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula
[17:51:03] <bobbytek> That was very useful
[17:51:09] <bobbytek> ehershey: Thanks :)
[17:52:09] <ehershey> ah, cool
[17:52:11] <ehershey> no problem!
[17:54:45] <asturel_> anyone knows there is no package for debian which contains mongoclient _shared_ library?
[17:55:22] <asturel_> the example on mongodb advised that link dynamic againts the lib now i screwed because on debian there is only static lib
[20:24:24] <daidoji> hello, is there a way to $sum with teh agg framework with values stored as strings?
[20:24:52] <daidoji> I've tried something similar to db.foo.agg(... {$sum : parseFloat('$FIELDNAME') } but its not working
[20:25:06] <cheeser> not afaik
[20:26:22] <daidoji> cheeser: :-( fair enough, is there a way to force a BSON type when I load? or do I just magic my way into the db ie) field + 0.0 or something?
[20:26:37] <daidoji> errr 0.0 + field I mean
[20:26:54] <cheeser> at best you'd still get a string out of that.
[20:28:01] <q85> daidoji: you can accomplish this using the map/reduce framework.
[20:28:54] <daidoji> q85, word, I was just hoping
[20:29:25] <q85> kk
[20:34:31] <garietyxxx> Hi, #mongodb, I'm building an app with multiple models with structure: Post, Photo, Event, etc.
[20:35:06] <garietyxxx> But I can't wrap my head around wether mongodb will work. Cause what if I want to query all those models form the database at once? I'd have to do three separate queries.
[20:35:18] <garietyxxx> So would Postgres work better and I should do a JOINS?
[20:35:24] <cheeser> unless you embed some documents in others
[20:35:51] <garietyxxx> yes?
[20:35:56] <cheeser> yes
[20:36:06] <cheeser> i guess
[20:36:09] <garietyxxx> I'm not embedding one docuemnt in another
[20:36:15] <garietyxxx> so no mongo?
[20:36:22] <cheeser> what? no one said that.
[20:36:36] <garietyxxx> Oh I'm trying to decide between mongo, postgres, and redis
[20:36:45] <cheeser> i get that.
[20:36:51] <garietyxxx> But I have three different models, how can I query them all at the same time with mongo?
[20:36:55] <garietyxxx> seems like I can't, not what mongo is for
[20:37:09] <cheeser> http://docs.mongodb.org/manual/data-modeling/
[20:38:09] <garietyxxx> I've skimmed that, but I'm in over my head a bit.
[20:38:22] <garietyxxx> It seems liek that suggests I coudl have a "Thing" model above all the others I can query.
[20:38:27] <garietyxxx> right?
[20:38:38] <cheeser> well, this is something you'll need to understand if you hope to make an intelligent, informed decision.
[20:38:50] <garietyxxx> yeah, I'm just confused, so I turned to irc
[20:40:25] <garietyxxx> None of my models contain one another, they're all on the same level
[20:40:42] <garietyxxx> So is there any point in using mongo? or is that just slowing me down.
[20:41:24] <cheeser> 1. i don't have enough info to say. 2. i think i'd probably have a different model than you're describing but see #1
[20:41:47] <arrty> does the mongodb driver just use JSON.parse internally?
[20:43:38] <cheeser> which driver?
[20:44:56] <garietyxxx> I think he means node-native-mongodb
[20:45:03] <garietyxxx> https://github.com/mongodb/node-mongodb-native
[20:48:24] <daidoji> garietyxxx: in mongodb your best bet is to denormalize (ie embed documents within eachother) if you have a data set with a bunch of joins you're better off with postgres probably
[20:48:41] <daidoji> unless you have a Lot with a capital L of joins in which case maybe a graph database would be best
[20:50:28] <daidoji> after that its just personal preference
[20:50:29] <garietyxxx> I seeeee
[20:50:34] <garietyxxx> Okay that makes sense to me
[20:50:42] <garietyxxx> thank you
[20:53:14] <daidoji> well I'm glad it makes sense to him, I'm still coming to grips with that after 5 professional years of data modeling
[20:55:53] <cheeser> making sense and getting it right are often very different. ;)
[20:59:45] <dump> /clear
[21:17:24] <daidoji> q85: is there any reason a MapReduce would fail with NaN but succeed if I pass it a { query: { field: 'blah' } } filter?
[21:17:43] <daidoji> with my above issue of converting strings to floats?
[21:18:02] <daidoji> is the issue that I'm running into the MapReduce limits if that happens?
[21:18:50] <q85> can you send me the map/reduce?
[21:19:16] <daidoji> sure, I'll gist it
[21:19:20] <q85> ty
[21:23:49] <daidoji> https://gist.github.com/daidoji/1ef55617e69553afc4f8
[21:24:18] <daidoji> q85: its pretty simple, it passes if I pass it only like 2 documents with a { query } filter to mapReduce, but fails on the full dataset
[21:27:22] <q85> it'll be a minute before I can get to it.
[21:27:59] <daidoji> q85: no worries
[21:34:18] <daidoji> is it possibly related to this issue maybe? http://osdir.com/ml/mongodb-user/2011-02/msg00915.html
[21:38:20] <daidoji> no wait, thats not it...
[21:40:20] <daidoji> actually, I got to go to a meeting
[21:40:35] <daidoji> exit
[21:40:38] <daidoji> \quit
[21:43:15] <moleWork> is there any good examples of a node.js application that uses mongodb that is "production quality". Soon as I start load testing my app everything gets ugly really quick
[21:44:46] <moleWork> i think most are my problems with node.js monogo db driver and not mongodb itself
[21:48:03] <moleWork> it seems to me like you need a lot of error handling logic for every database operation because you can get a lot of random errors when the driver is in certain states
[21:50:06] <moleWork> it it doesn't seem to me like you can use the internal _state objects of the mongoclient or the db objects reliably
[23:32:52] <larkith> hi guys
[23:33:47] <larkith> I added a new member to a rs today and now I'm getting "not master or secondary; cannot currently read from this replSet member" every hour from the app
[23:33:50] <larkith> any ideas?
[23:34:23] <cheeser> connect to one of your replSet members and run rs.status()
[23:34:37] <larkith> yeah, seems fine
[23:35:08] <larkith> the weird thing is that I get that error exactly every hour
[23:35:28] <larkith> for 1 minute and then it is ok again
[23:38:26] <larkith> cheeser: http://pastie.org/private/ufo0qus7ghmzbmjgcoys8q
[23:40:01] <cheeser> nothing in the client logs?
[23:41:53] <larkith> the client logs display that error I am running with safe: true