PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 24th of April, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:38:59] <ranman> joannac heyo
[00:41:12] <joannac> hey ranman
[00:44:36] <brucelee> and all reads can be on primary or replica sets right?
[00:44:39] <brucelee> can be from*
[00:45:20] <ranman> brucelee: you can set read concerns to
[00:45:49] <ranman> brucelee: if you have a read concern like "primaryPreferred" it will read from the primary if it's available or a secondary if it's not
[00:46:09] <ranman> brucelee: or you could do secondaryPrefered and it would try to minimize the number of reads hitting the primary
[00:46:16] <ranman> brucelee: there are read concerns and writeconcerns
[00:46:39] <brucelee> ahhh
[00:46:39] <brucelee> sweet
[00:46:40] <brucelee> thanks ranman
[00:46:56] <ranman> brucelee: http://www.slideshare.net/ranman96734/replication-28997225
[02:14:20] <shesek> Hey. I'm thinking of using mongodb for user notifications pub/sub, with a capped collection and a tailable cursor. Do you think this is a good idea, or should I be using something more specialized for this purpose?
[02:18:38] <Mark_> i think thats probably not a good use case
[02:18:44] <Mark_> but im finding mongo usage pretty narrow myself
[02:19:03] <Mark_> youd probably be better off with redis for your usage
[02:19:43] <Mark_> i think of mongo like a key/value store on steroids with a bit more structure
[02:20:02] <cheeser> ...
[02:20:09] <Mark_> but theres free mongodb providers, so sometimes i use it even though mysql or postgres would be better
[02:21:29] <shesek> Mark_, the thing is that I do need to persist those notifications anyway, until the users go and read them. so its really a combination of persistent storage + immediate notification (pushed to clients via a websocket)
[02:21:35] <shesek> which doesn't really fit redis
[02:21:52] <shesek> I could use mongo for persistent storage, then something else in addition to that for the pub/sub
[02:22:33] <shesek> but... I dunno. I would rather not introduce a separate technology just for that if I could handle that with mongo as well
[02:23:22] <shesek> ... unless other solutions have compelling advantages over mongodb that justifies it
[02:23:32] <Mark_> redis can persist
[02:23:43] <Mark_> memcache cant etc
[02:24:03] <Mark_> but if you're already using mongo, just use mongo
[02:24:20] <xissburg> sup mongord
[02:24:27] <xissburg> *mongoes
[02:24:36] <shesek> I know it can (I'm using redis on some other projects), but I don't feel like what I'm doing here really the intended use case for redis
[02:25:38] <Mark_> well, i think you can probably bend any of them to your will
[02:25:44] <Mark_> its a matter of convenience i suppose
[02:25:59] <Mark_> at its core it sounds like you can distill your need to
[02:26:11] <Mark_> 'a list of people each with a list of shit to send them'
[02:26:25] <Mark_> theres not much need for further relationships
[02:26:54] <Mark_> i dont think redis or mongo really have much speed difference or functional difference in persisting that usage
[02:27:06] <Mark_> the mongo php driver is better than the redis landscape, so if it were php id use mongo,
[02:27:14] <Mark_> those are the types of factors id be thinking of for something like that :P
[02:27:17] <Mark_> 'which apis are better'
[02:27:23] <Mark_> 'which do i already have setup'
[02:31:59] <shesek> fghjnm,.]-4jArj m,;.'
[02:32:12] <shesek> ffghgipo[]\
[02:34:21] <Mark_> :P
[02:36:02] <shesek> sorry! I spilled coffee all over my laptop, and typed that out while cleaning it
[02:39:10] <Mark_> so i whipped up npa.herokuapp.com using mongo
[02:39:16] <Mark_> i traditionally used mysql
[02:39:25] <Mark_> why did i use mongo? because it was a free option
[02:43:15] <shesek> Mark_, thanks for your input. you're definitely right, those considerations can definitely be more important than which technology is "better" in many cases
[02:44:03] <shesek> it looks like its somewhat of a pain with mongodb though, because you can't keep a tailed query on an empty collection
[02:44:43] <shesek> I'm thinking that I'll probably store it as documents on mongo, and use something separate just for the live pub/sub
[02:47:47] <Mark_> theres also MQ options
[02:47:54] <Mark_> havent been too deep down that road though
[04:41:24] <in_deep_thought> what are the elements in a .find() query sorted by if no .sort is given?
[06:28:18] <shesek> How would you go about this: I have a list of notifications for users, with a state of read/unread. I want to periodically delete old read notifications, but always keep the last 5 notifications. For example, if I have 3 unread notifications and 7 read notifications, I would want to delete the 5 oldest read notifications to end up with a total of 5 notifications (3 unread + 2 read)
[06:29:21] <shesek> would I have to implement this login in app-land, or could I get that logic into a remove() query and let mongodb handle that?
[06:29:31] <shesek> s/login/logic
[08:50:29] <bin> is there a way
[08:50:44] <bin> to use 'less' (like in linux) when trying to view many results
[08:50:45] <bin> ?
[08:53:22] <Nodex> to iterate ?
[09:16:27] <Lujeni> bin, from the shell ?
[11:54:57] <Asweb_> Hi everyone
[11:55:06] <Asweb_> Does someone here knows how to use indexes?
[11:57:38] <kali> 373 people here. i guess this is a rethoric question
[11:59:22] <Asweb_> Kali: Can you show me a small example of .find() using indexes?
[11:59:47] <Asweb_> I always use .find() and pass usually the id as a parameter
[12:03:00] <kali> you don't have to use the index explicitely. the optimizer will decide
[12:03:11] <Aswebbb> Mhh ok
[12:03:25] <Aswebbb> Do you use then .ensureIndex?
[12:05:33] <Lujeni> Aswebbb, humm u must RTFM :)
[12:08:05] <Aswebbb> Haha true Lujeni
[12:11:49] <kali> Aswebbb: yeah, you need to create the index before using it
[14:27:03] <topwobble> We store timezone as seconds_from_gmt but are changing to using a number between 0 and 23. I need to modify every document in a collection by modifying the timezone property by a function. I am worried that this collection update will take a long time and block mongo (we have 4+ million documents). Will “db.users.update({timezone: -18000}, {timezone: 23}, {$multi: true})” block mongo while it is running?
[14:28:47] <Nodex> why not clone the collection to another db ?
[14:28:53] <Nodex> do the update and put it back
[14:30:56] <rspijker> topwobble: first off, better use a $set there. Second, the write will in principle lock the DB (but there is yielding of locks in some cases)
[14:33:18] <topwobble> Nodex: idk how to do that :D
[14:33:37] <topwobble> rspijker: ok. how do i know whether this will yield?
[14:33:50] <rspijker> it yields when it has to hit disk, for instance
[15:02:46] <jillesme> Hey guys, is a collection comparable to a table in SQL?
[15:03:38] <Nodex> yup
[15:03:48] <Nodex> document is comparable to a row
[15:03:53] <Nodex> key comparable to a column
[15:06:57] <jillesme> Nodex: thanks, you're awesome! I want to create a yes/no app in node and mongodb.. This is my initial db 'design' http://vpaste.net/iWIkE
[15:07:08] <jillesme> Do you have any comments on it? Am I approaching it right?
[15:11:49] <Nodex> just be aware of the 16mb document limit
[15:12:12] <kali> you may want to maintain a count of both types of votes as a separate field
[15:12:19] <kali> or separate fields, actually
[15:12:33] <Nodex> secondly I would be findAndModify where "name" $nin voted or somehting
[15:12:38] <Nodex> else it will be abused!
[15:13:38] <kali> $addToSet could also work, but findAndModify with the $nin will also preserve the cunters if you decide to have them
[15:14:44] <jillesme> To be quite honest guys, I'm a complete mongo virgin. I just installed it on my server at DigitalOcean
[15:14:57] <jillesme> Bought the best domain ever.. http://jilles.sexy
[15:15:19] <kali> congrats, i guess
[15:15:44] <jillesme> Thanks, you'll see a yes/no question app there soon
[15:15:59] <jillesme> Hey, buy if there's a 16mb limit, how would I do it if, let's say I get millions of users?
[15:16:13] <jillesme> buy=but
[15:16:20] <kali> usr more than one document :)
[15:16:26] <kali> s/usr/use/
[15:17:12] <jillesme> Will this affect speed much?
[15:17:22] <jillesme> Compared to, for example MySQL
[15:18:45] <kali> it depends how you do it. this blog post is not dealing strictly with the same issue, but it can give you an idea on how to scale http://blog.mongodb.org/post/65612078649/schema-design-for-social-inboxes-in-mongodb
[15:19:49] <kali> also, note that your current schema proposal will handle several hundreds of voters as is
[15:19:55] <kali> even with the 16MB
[15:21:19] <jillesme> I don't get the word 'cursor', it's so un-logical.. I associate it with my mouse pointer. Is that just me?
[15:21:32] <Derick> yes :-)
[15:21:39] <Nodex> haha
[15:21:51] <Nodex> I associate it with someone who swears a lot!
[15:21:57] <kali> Nodex :)
[15:21:58] <Derick> that's a cusser
[15:22:07] <Nodex> :P
[15:22:19] <Nodex> my humour is lost in transit!
[15:22:31] <Derick> Nodex: at least not in translation!
[15:23:33] <Nodex> haha
[16:16:44] <test123> anybody here have some good pros and cons for mongo-connector for elasticsearch?
[16:19:04] <test123> anybody?
[16:22:12] <test123> mongodb-connector vs elasticsearch mongo river, for elasticsearch any help?
[16:28:11] <Nodex> anyone have some patience?
[16:37:58] <test123> I have patience :)
[16:41:42] <shinDog> i have a collection that's littered with objectid references but I want to make them embedded, what's the best way to go about doing that? I thought about looking up the document by its ID and inserting/replacing it in the original document but I can't find any info on how to do that which makes me think I'm barking up the wrong tree..
[16:42:50] <test123> are the references all within the same collection?
[16:44:51] <shinDog> nope, in a Book-Author example I've got all the Authors as objectid references held in the Book documents
[16:45:42] <shinDog> the database is live so I'm looking for a migration strategy
[17:01:38] <test123> I don't know that much but can you just find each doc by the id?
[17:02:49] <test123> Then take the results of the find and insert that
[17:06:04] <jillesme> I can't start and restart mongo :(
[17:06:21] <jillesme> http://vpaste.net/JjFnz
[17:06:24] <jillesme> Anyone has any idea/
[17:06:42] <jillesme> I have visited the link by the way
[17:10:31] <kali> come on.
[17:10:38] <kali> follow the money
[17:12:28] <jillesme> I did :(
[17:15:40] <shinDog> thanks - i'm getting somewhere now, I didn't understand before that find() returns a cursor to iterate over the documents so the results of find() was confusing me
[17:16:35] <jillesme> Does someone see a 'register' button? http://dochub.mongodb.org/core/startingandstoppingmongo
[17:30:49] <arussel> I'm doing an update on an object, is there a way to say: set field 'a' to max(currentValue, 5) ?
[17:34:54] <kali> arussel: http://docs.mongodb.org/manual/reference/operator/update/max/#up._S_max brand new in 2.6
[17:35:20] <arussel> thanks, I was reading: https://jira.mongodb.org/browse/SERVER-1534
[17:35:31] <arussel> but couldn't find it in the doc
[17:38:47] <jillesme> MongoDB is so awesome I want to die
[17:40:19] <Aswebbb> Mhh. .find({ email : .... , username: ... }, { email: 1 , username : 1 })
[17:40:26] <Aswebbb> it returns also the other fields
[17:40:37] <Aswebbb> even if I specified that I only want "email" and "username"
[17:46:16] <tskaggs_> Hey! I just got a two csv dumps: locations.csv and product.csv. Originally the associate was made via IDs (location ID 1 has products with ID 1). I'm using the 'owner' field in the products to work with node. So the products has for example "owner": 1. The Location's ID was changed when I imported them into the Mongodb but I made a field called 'original_id' to keep that handy. now I need to update the product 'owner'
[17:46:16] <tskaggs_> field to be the location's mongo ID.
[17:47:24] <tskaggs_> Is there a way to query location 'original_id' and match it with all the products with the matching 'owner' and then update the product's 'owner' with the new location 'id'?
[17:52:50] <JoeyJoeJo> Does Mongo have write locks (ie can two things write to the DB at the same time)?
[17:58:25] <cheeser> JoeyJoeJo: yes it does and no.
[18:00:24] <JoeyJoeJo> ok, thanks
[18:44:26] <tongcx> hi guys, is there javascript library which can parse sth like '{"time": {"$date": 123456}}' into proper object?
[19:11:51] <Zelest> kali, any feedback regarding this layout: http://pastie.org/private/32dqjjbs3rtcaxaltpywq
[19:12:07] <Zelest> the actual data is stored in a separate collection
[19:35:33] <arussel> I set a field to a value 'x' -> 'a'. once the value is chosen, the client will always set it to the same value, so only the first set is significant.
[19:36:26] <arussel> would it be better to first do a read and then set if this is not set or just write everytime ? what should I take into account to have a meaningful answer ?
[19:54:46] <locojay> does find({}) use a pagination of size limit internally for large collections...
[19:55:41] <cheeser> it gives you a cursor with a default batch size (20, iirc)
[19:58:14] <locojay> thanks i can just next on the cursor and pass to a lazy sequence...
[19:59:08] <cheeser> your driver should handle that transparently for you
[19:59:21] <locojay> mongodb-erlang misses alllot of love ;)
[19:59:28] <cheeser> heh
[20:45:54] <toraRTC> I keep getting "not authorized on admin to execute command" when trying to add a user to the admin db, I can't figure out how to authorize mysel
[20:46:25] <toraRTC> using createUser
[21:20:59] <bel3atar> I have a collection like this http://ix.io/bUx . How would I calculate the sum of outs for lot 1?
[21:38:37] <bel3atar> I have a collection like this http://ix.io/bUx . How would I calculate the sum of outs for lot 1?
[21:42:38] <ranman> bel3atar: have you looked at $sum and the aggregation framework
[21:43:08] <bel3atar> ranman: yes, I could do it with a structure this deep
[21:43:26] <bel3atar> s/could/couldn't
[21:47:26] <ranman> bel3atar: so the result you're looking for in the case you mentioned is: 1.1 ?
[21:47:49] <bel3atar> ranman: yes
[21:55:02] <ranman> bel3atar: and you're only interested in lot1?
[21:55:25] <bel3atar> ranman: yes
[22:06:51] <durango> I have a slug field such as my-slug-13, my-slug-7, how can I check for the "highest number" from my-slug-X?
[22:12:18] <fl0w> I have a bunch of documents with the following structure (excerpted) https://dpaste.org/TZy9 and I would like to re-order these (changing the pair value of order) within the document. I don’t care about the order of the array (unless there’s a reason to?). My real problem is here that I need to have it anatomically (isolated?) changed. How could I accomplish this? Or am I just chosing the wrong tool for this problem?
[22:14:25] <fl0w> I understand when updating a document it’s atomic - but I can’t really re-calculate the order for each object (sub-document really) within the query? I need to do it at application level, which basically requires me to do a manual “lock”? Or can I do it some other way?
[22:19:20] <bel3atar> I have a collection like this http://ix.io/bUx . How would I calculate the sum of outs for lot 1?
[22:21:02] <fl0w> bel3atar: do you have to do it in query?
[22:21:12] <bel3atar> fl0w: yes
[22:22:10] <fl0w> bel3atar: tried with a map-reduce?
[22:22:21] <bel3atar> fl0w: no
[22:22:33] <fl0w> http://docs.mongodb.org/manual/tutorial/map-reduce-examples/#return-the-total-price-per-customer
[22:22:57] <fl0w> Using the aggregation framework
[22:36:13] <ranman> bel3atar: are you still there?
[22:36:44] <ranman> bel3atar: this is one way of doing it but it looks pretty... hacky
[22:36:45] <ranman> https://gist.github.com/ranman/11271886
[22:52:16] <bel3atar> ranman: nice
[22:57:45] <ranman> bel3atar: thanks, performs better than mapreduce in my tests with <10k docs
[23:05:22] <bel3atar> why is mapreduce slower in almost all cases?
[23:05:33] <bel3atar> is not all
[23:05:37] <bel3atar> if
[23:06:01] <Zelest> it maps the performance... then reducdes it! :D
[23:06:05] <Zelest> reduces*
[23:08:15] <jjsam> Does MongoDB support mutable BSONObj in C++? From https://github.com/mongodb/mongo-cxx-driver, I am not finding the mutable BSON API. But https://jira.mongodb.org/browse/SERVER-8046 says it is already fixed in 2.5.1. Is it wrong?
[23:11:37] <ranman> bel3atar: mostly the fact that it has to push everything into the javascript engine to do work
[23:13:54] <jjsam> ranman, are you saying C++ API is less capable than JavaScipt API?
[23:37:46] <Zelest> How can I fetch an object and return only a single element of an array.. the array contains objects with a ISODate() and I want the oldest object in that array.. is that possible in a single query?
[23:53:36] <shanlar-> what is the best driver to use for delivering images out of gridfs?
[23:54:18] <shanlar-> ive read nginx-gridfs is not async and blocks on requests
[23:55:26] <shanlar-> i currently have 700gb of user images i am looking into moving to gridfs. simplify replicas, DR, and backups.