PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Saturday the 19th of April, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:37:24] <Ephexeve> Hey guys, is there a way to put a password to a database? So when I would like to query anything from that db, I need a password first? Otherwise there is NO way I can access it?
[03:19:22] <Reptar> How do I create a collection that is comprised of aggregate groupings from other collections?
[03:40:17] <Mark_> so i just rewrote it with $in/$nin but
[03:40:20] <Mark_> why wouldnt this work
[03:40:21] <Mark_> db.commandlog.distinct('Account', { AccessLevel: { $ne: 'Player', $ne: 'Administrator', $ne: 'Developer', $ne: 'Owner' } } );
[03:40:44] <Mark_> multiple $ne implicitly anded dont work?
[03:44:28] <Mark_> seems like they are being or'd based on the results
[03:44:28] <Mark_> oh well
[03:55:56] <laprice> OK. I need to get timing details for a set of queries on mongodb.
[03:56:41] <laprice> I've tried the db.collname.find({ foo: "bar" }).explain().millis trick.
[03:57:20] <laprice> but a. that seems really lame. b. http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain.millis
[03:57:45] <laprice> that number is not actual milliseconds, I don't know what it is.
[03:58:37] <laprice> So I'm bashing away at system.profile.find() and I want to always get the most recent query. But I am not getting any joy.
[03:59:56] <laprice> system.profile.find() doesn't let you do system.profile.find({ ns : "collname" }) and only get info on queries against your collection?
[04:05:44] <laprice> actually it looks like system.profile.fine({ ns : "dbname.collname" }) works.
[04:05:58] <laprice> But how do I get only the most recent one?
[04:07:09] <laprice> system.profile.fine({ ns : "dbname.collname" }).limit(1) goes in the wrong order
[04:15:32] <laprice> http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain.millis is that just a doc bug? b/c "reflects" does not tell me if that number is milliseconds, or if it's some metric vaguely related to, or derived from the number of milliseconds required to find the document.
[09:49:26] <chronic52> Best source for advanced mongo
[09:49:33] <chronic52> ?
[09:50:47] <tinco> hey guys, I'm performing an update, and in this update I want to upsert an element but in the documentation there is only a push, and the push doesn't seem to have an upsert modifier
[09:51:01] <tinco> how could I achieve this?
[09:54:23] <tinco> so I have this collection: {"notifications" : [{"id" : 1, "occurrences" : [{"id" : 1, "created_at" : 353251}]}]}
[09:54:59] <tinco> ehm no
[09:55:26] <tinco> so I have this collection: {"notifications" : [{"id" : 1, "occurrences" : [{"id" : 1, "created_at" : 353251}], "uniqueProperty" => "superUnique"}]}
[09:58:22] <tinco> and then I do notifications.update({"uniqueProperty" : "superUnique"}, {'$push' : {'occurrences' : {"created_at" : 353251 }}, {"upsert" => true})
[09:59:14] <tinco> but this will push a new occurrence every time it gets updated, I only want to push a new occurrence if the created_at does not match an existing occurrence
[10:03:25] <kali> waaaa wait.
[10:03:32] <tinco> ok
[10:03:43] <chronic52> Best source for advanced mongo ?
[10:03:44] <kali> what's the collection ? "notifications" ?
[10:03:49] <tinco> yes
[10:04:38] <tinco> so I create a new notification, or update an existing one based on "uniqueProperty", and when I update an existing one, I want to add to its occurrences array, but only if there's no occurrence at that date yet for that notification
[10:05:26] <kali> so you want to add something to an array if it's not already there, right ?
[10:05:59] <tinco> yes, but the addToSet thing does not allow you to specify an equality property
[10:06:19] <kali> ok
[10:07:03] <kali> notifications.update({"uniqueProperty" : "superUnique", "occurencies.created_at" : {$ne: 353251} }, {'$push' : {'occurrences' : {"created_at" : 353251 }}, {"upsert" => true})
[10:07:06] <kali> what about that ?
[10:07:24] <kali> and ditch the upsert
[10:09:16] <tinco> won't that create a new notification whenever there's a new occurrence, even if it has the same uniqueProperty?
[10:10:32] <tinco> I realize my query is a bit absurd, because I'm basically doing 2 upserts in one query
[10:10:35] <kali> mmmm update will not create a anything if there is no upsert
[10:11:14] <kali> i thnk it may work actually
[10:11:25] <kali> i'm not sure :)
[10:11:30] <kali> you may need two queries
[10:11:34] <kali> try it
[10:12:11] <tinco> so this query is in a pretty time critical location, it might be called hundreds of times per second, so I'd like to avoid making it two queries
[10:12:26] <tinco> perhaps I could make it some sort of prepared statement? mongo has that right?
[10:12:30] <kali> nope
[10:12:51] <tinco> I thought I heard you could execute javascript in mongodb
[10:13:06] <kali> you don't want to do that if you're after performance :)
[10:13:12] <tinco> ok :P
[10:13:21] <tinco> hmm
[10:14:16] <tinco> my concern is that there might be hundreds of occurrences per second, and if I just push them all into that occurrences array, it could become very big and slow to query, or perhaps even go over the mongo element size limit
[10:15:05] <tinco> perhaps two queries isn't so bad
[10:16:34] <tinco> thanks btw kali, I think it's the second time you've helped me here
[10:16:36] <kali> tinco: have you tried it ? because i think it actually does what you want
[10:17:02] <tinco> oh alright, let me run it
[10:17:03] <kali> tinco: the actual insert is killed by the unique index
[10:17:36] <kali> tinco: http://privatepaste.com/b5dde66681
[10:28:43] <tinco> kali: http://privatepaste.com/c2799446b5 <-- see how it creates a second notification object, when the created at matches? or did I make a mistake?
[10:29:33] <tinco> oh
[10:29:34] <tinco> wait
[10:29:36] <tinco> unique index
[10:29:39] <kali> tinco: you need a unique index somewhere
[10:29:42] <kali> yeah
[10:29:57] <kali> i used the one on _id, but it can be somewhre else
[10:30:56] <tinco> yeah that's the problem, I can't use a unique index, I don't know the unique index yet when I create the notification
[10:32:05] <kali> you may need two queries :)
[10:32:21] <Zelest> can I have a $pull and $push in the same query?
[10:32:28] <kali> yes
[10:32:30] <Zelest> thinking about my linking thingie we talked about kali
[10:32:32] <kali> Zelest: on the same array ?
[10:32:36] <Zelest> yeah
[10:32:51] <Zelest> think when I hit a 301/302 reply
[10:32:55] <Zelest> i want to update the links
[10:33:00] <kali> Zelest: i'm not sure :) what are you trying to do ?
[10:33:05] <Zelest> ^
[10:33:29] <kali> Zelest: you need to try it
[10:33:32] <Zelest> (not sure if you remember, but i was trying to build a crawler)
[10:33:37] <kali> yeah
[10:34:38] <Zelest> boo, no 2.6 yet :(
[10:35:54] <Zelest> kali, when I have this array later on, {_id: ObjectId, to: [links1, links2, links3, ...]} .. can I efficiently get the number of links for let's say links3
[10:36:04] <Zelest> iirc, count() is expensive as fsck
[10:36:28] <kali> Zelest: there have been some improvements around count() when an index is present
[10:36:38] <Zelest> aah
[10:36:50] <Zelest> so in my case, it's "fast" ?
[10:36:57] <kali> not sure that will work for multikey
[10:37:20] <Zelest> ah
[10:44:50] <tinco> kali: is it possible to get the update result printed in the mongo shell? I can't find an option anywhere
[12:53:54] <bsdbandit> good morning all
[15:53:47] <ThiefMaster> hi, i'm trying to search documents using this condition: "somefield needs to contain all words from the search query". is there a nice way to do this using mapreduce or the aggregation pipeline? or should i use fulltext search instead?
[15:54:19] <ThiefMaster> (meh, fulltext-search is not an option since gentoo doesn't have an ebuild package for 2.6 :x)
[16:51:30] <kali> ThiefMaster: 2.4 has full text
[19:17:27] <hydrajump> hi anyone following the university node.js course at the moment?
[19:54:44] <brucelee_> are mongodb binary executables supposed to be like 253MBs each?
[19:55:14] <brucelee_> http://hastebin.com/duxotovame.diff
[19:55:23] <brucelee_> doesnt seem right to me... but ive never managed mongodb instance
[19:56:53] <Jadenn> brucelee_: no, that isn't right http://paste.arviksa.co.uk/bufohedahawaxija
[19:57:09] <Jadenn> you should backup your configs/data and replace the mongo binaries
[19:58:44] <Mark_> if i have a deeply nested set of arrays as my document
[19:58:51] <Mark_> how do i actually access them
[20:00:12] <Mark_> if i have 201: { 200: { 123: { etc
[20:03:25] <Jadenn> depending on what language you are accessing it from, you would get the root array
[20:05:11] <brucelee_> Jadenn: hm weird, know why my mongodb binary executables are so large? :p
[20:05:23] <brucelee_> im using a compiled version of mongodb that works with ssl
[20:06:13] <Jadenn> i couldn't say, i am not familiar with the compilation process of mongo
[21:01:03] <Mark_> > db.npa_nxx_y_ocn.find({}, {"480.999.0": 1, "480.999.-1": 1})
[21:01:03] <Mark_> { "_id" : ObjectId("5352df61fbaa88b24504a810"), "480" : { "999" : { "0" : "587F", "-1" : "579F" } } }
[21:01:07] <Mark_> anyway to optimize that further?
[21:01:28] <Mark_> seems pretty fast but i hate basically repeating the first two field names twice
[22:35:50] <Simonn> is pmxbot here on behalf of the channel administration?
[22:36:06] <Simonn> Cause the logging is enabled notification is really, really annoying
[22:46:54] <Jadenn> doesn't notify me of anything
[22:50:19] <Mark_> maybe its just me but
[22:50:24] <Mark_> subdocuments are just not intuitive
[22:51:07] <Mark_> http://i.imgur.com/f9FW2.gif
[22:51:11] <Mark_> feeling like that
[22:51:42] <Mark_> i can either hammer out my data in flat field layout
[22:51:46] <Mark_> and have a 40mb db
[22:51:58] <Mark_> or i can properly (presumably?) subdocument it out in a tree structure
[22:52:10] <Mark_> but im finding working with the constructs extremely obnoxious