PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 20th of February, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[06:00:14] <Soothsayer> Is the unset operator my only way to clear all elements in an an array field?
[06:00:54] <Soothsayer> Can I just 'empty' the array anyway? without actually unsetting the field
[06:01:57] <ron> not so much a Soothsayer now, are you?
[06:02:39] <Soothsayer> ron: google is failing me
[06:03:01] <ron> have you tried setting the field to an empty array?
[06:28:39] <Soothsayer> ron: Using an ORM/ODM, trying to figure out how can I by pass the type. (Since its an array of sub-documents)
[06:29:02] <ron> that may depend on the ODM
[06:54:36] <brucelee_> if i have a mongo host, a config server, and a shard setup
[06:54:44] <brucelee_> in this stack, which one would be most IO intensive?
[07:02:26] <Number6> brucelee_: The Mongo host that holds the data
[07:02:52] <Number6> brucelee_: So the mongoDs that are not config servers
[07:03:22] <Soothsayer> ron: you around?
[07:03:28] <ron> Soothsayer: always.
[07:03:36] <Soothsayer> Is there a way I can clear an array and addToSet in the same update query?
[07:04:58] <ron> that doesn't make sense to me. just set the field to whatever you want.
[07:13:09] <Soothsayer> ron: on second thought, my requirement was invalid.
[07:44:30] <brucelee_> Number6: ah ok
[07:44:40] <brucelee_> Number6: the mongo shards actually host all the data right?
[07:45:00] <brucelee_> Number6: there are mongos which are the routers, and theres also the config servers
[07:45:19] <brucelee_> i was wondering for a pretty busy mongo stack, what would be the typical behavior
[07:51:33] <Number6> brucelee_: Exactly
[07:51:45] <Number6> The shards will be the busiest
[07:52:17] <Number6> particularly if your dataset is large, and doesn't fit in RAM. Or you're doing updates that increase the document size
[07:52:29] <Number6> Although the later can be mitigated
[08:47:39] <Number6> Rozza!
[08:48:02] <Rozza> hai
[09:39:32] <sudo_o> How can you filter by date to only get the last matching document using the aggregation framework?
[09:45:59] <Nodex> the latest matching doc or the last matching document?
[09:53:07] <sudo_o> the document in which the 'date' field is the largest
[09:54:03] <Nodex> that doesn't answer the question
[09:55:23] <sudo_o> if I do an aggregation on the key 'foo' two documents are matched, the documents have a `date` field on has yesterdays date and the other has the day before yesterday
[09:55:29] <sudo_o> I only want yesterdays document
[09:56:21] <Nodex> ok so the most recent then
[09:56:34] <Nodex> do you use objectId's?
[09:56:40] <sudo_o> no
[09:57:07] <Nodex> then you need to do a reverse sort on the date and limit 1
[09:59:32] <sudo_o> I tried that $sort seems to have no impacted on the order of the results array
[10:00:05] <sudo_o> both {$sort: {date: 1}} and {$sort: {date: -1}} give the same order
[10:00:16] <sudo_o> the date field is a Date type
[10:01:21] <Nodex> can you pastebin a typical document?
[10:06:01] <jepoy> hi guys
[10:06:08] <jepoy> anyone around?
[10:06:15] <Nodex> best to just ask the uestion
[10:06:19] <Nodex> +q
[10:07:29] <jepoy> im setting up a multi region mongodb, 1 want a region to replicate to another region the there will be sharding within each region how can i start with that?
[10:08:02] <Nodex> you can tag replicas iirc, it's all in the docs, there is a good write up on data center awareness etc
[10:09:23] <jepoy> can you give me a link to that doc? sorry.
[10:12:15] <jepoy> i found the docs interesting and thank you so much
[10:13:21] <Nodex> http://docs.mongodb.org/manual/core/replica-set-architecture-geographically-distributed/
[10:23:43] <jepoy> thanks Nodex
[10:25:07] <Nodex> no probs
[11:43:50] <dmarkey> Does the aggregation framework effectively split the load among all nodes?
[15:03:35] <djlee> Hi all, anyone know how i can update an entire collection, to set a "created_at" attribute to a random date
[15:04:00] <cheeser> each doc with a random date? or each with the same date?
[15:04:00] <djlee> Can it be done via CLI query style, or do i need to write a script to loop and update?
[15:04:22] <djlee> each doc set a random date, generated fresh for each document
[15:04:47] <mathieue__1> hello
[15:04:51] <cheeser> you'd have to iterate the cursor in the shell and update each one
[15:04:52] <djlee> basically, all my "created_at" attributes are in a time period of a few seconds. i want to spread them out over a few weeks or months
[15:05:09] <djlee> ok cheeser no worries, thanks. new to mongo, so i guess i'll go read up on cursors :)
[15:05:11] <mathieue__1> i cant find an index to fix this:
[15:05:12] <mathieue__1> command oneplaylist.$cmd command: { distinct: "tracks", key: "pos", query: { playlist_id: null } } ntoreturn:1 keyUpdates:0 numYields: 11 locks(micros) r:4511405 reslen:9159596 2321ms
[15:05:24] <mathieue__1> any idea ?
[15:38:09] <blumpkin40> hey guys, i'm thinking about using mongodb for a testingtool. got the following data: https://gist.github.com/fuhlig/9116392 1) what do you think about storing such data in a nosql db 2) does this structure work well in mongodb 3) how to specific object like browser.name = chrome > viewport.width = 600
[15:42:36] <Nodex> "browser.name" : "chrome"
[15:42:45] <Nodex> and
[15:43:20] <Nodex> {"browser.name" : "chrome", "browser.viewport.width" : 600}
[15:46:56] <blumpkin40> thanks Nodex
[15:47:17] <blumpkin40> tried it in the shell
[15:47:24] <blumpkin40> and it returns the entire record
[15:57:33] <Joeskyyy> generic question for curiosity here: if you read the sentence "find all users whose age is 45", in your mind is that db.users.find({age:45}) or db.foo.find({"users.age":45}). Obviously this is dependent on the schema one is trying to achieve, so put that aside in your head, think generally.
[16:00:00] <AlexejK> Joeskyyy, I would have a collection for users and NOT a collection that contains a document with list of users..
[16:00:07] <AlexejK> basically because of the 16MB document limit
[16:00:16] <AlexejK> so 1 document per user in users collection
[16:00:31] <Joeskyyy> Excellent, exactly the opinions I'm looking for AlexejK thanks :D
[16:00:38] <AlexejK> np
[16:00:48] <Joeskyyy> Nodex: You troll here often enough, could I bother you to chime in as well
[16:01:19] <Joeskyyy> I'm not trying to design a schema fwiw. Just curious for a project I'm working on with how people use mongo
[16:19:48] <Nodex> blumpkin40 : of course it does, you will need projection operators to sort the sub docs
[16:21:43] <blumpkin40> how to update e.g. the diffPercentage within {"name": "news", "browser.name": "chrome", "browser.viewport": 400}
[16:22:05] <Nodex> I don't know what that means sorry
[16:23:45] <blumpkin40> https://gist.github.com/fuhlig/9116392
[16:28:19] <sinisa> im stuck, my brain is exploding if someone can help :) .. colA , documents: {"group":"A","name":"nameA"},{"group":"B","name":"nameB"} .. i aggregate and sort it by "group", i need to group it in specific order from array for example groups["B","A"] ... how to do that?
[16:48:32] <jglover> Thinking about using Mongo for a project. I haven't really used it before, besides just for monkeying around with. Are there any definitive guides out there?
[16:48:34] <sinisa> how to group documents by predefined array ?
[16:49:13] <sinisa> jglover, just use it , definitive guides wont help if you dont understand how it works
[16:50:31] <jglover> sinisa: I'm really more interested in a document discussing when it's appropriate and when it's not. My only real constraint is that, with this project, a relational database won't work. So I'm looking for alternatives.
[16:51:10] <sinisa> relational database can work , why not?
[16:52:24] <jglover> sinisa:in this case, I won't be able to know the database schema beforehand, so an ORM is really out of the question, unless I generate code in a build file perhaps? It's too messy. I'm doing to try a document database
[16:53:04] <sinisa> mongo is ideal for this.. just push it in :)
[16:53:53] <jglover> sinisa: Alright, thanks for the info. The test cases I've worked with have been extremely successful.
[16:54:16] <sinisa> jglover.. how many records/documents it will contain
[16:54:48] <jglover> not sure yet. Thousands presumably.
[16:55:16] <sinisa> ok.. how many keys for each document
[16:55:55] <jglover> Not sure, that's set by whoever is creating the data. Could be one, could be 5.
[16:56:01] <jglover> could be more
[16:56:37] <sinisa> ok, so if its not millions of documents with hundreds keys in it .. just push it man, that Mongo bastard is fast as hell :)
[16:56:55] <jglover> sinisa: cool. I'm going to. Thanks a lot man!
[16:57:15] <sinisa> i have 10 sites like that (similar probably) and without any optimisation .. works like candy
[16:58:35] <sinisa> Ok, now , anyone clever enough to help me with my idiotic idea of grouping by external array, aggregation ? :)
[20:19:11] <tscanausa> is rs.conf() an alias for another command?
[20:22:39] <ehershey> tscanausa: you can view the function by typing rs.conf<enter> without parens
[20:22:52] <ehershey> function () { return db.getSisterDB("local").system.replset.findOne(); }
[20:23:38] <ehershey> so it's just showing the single record out of the 'local' db's 'system.replset' collection
[20:25:10] <tscanausa> ehershey: thanks
[20:32:09] <ehershey> no problem
[20:48:20] <zymogens> I see that mongod output goes to the mongo.log - is there any way to get that output to print out to the console instead?
[21:04:34] <andrewfree> Would I need denormalization on fields if I only set the field at initalization and it doesn't change? Or is the advantage in denormalization come from chaging that value at differentn points within an embeded/related structure?
[22:15:39] <sephreph> Hi, I'm using the .aggregate operation to summarize downloads we track based on IP address. I also store the file uploader's member ID as well as the downloader's member ID, and I wanted to exclude any records in my aggregation that had those matching (i.e. skip whe {memberID == ownerID}) but the only way I've found to do that is using $where which doesn't use indexes as far as I know. Any idea if it's possible to exclude resul
[22:43:21] <tripflex> that first link i posted
[22:43:26] <tripflex> the youtube video at the bottom is very helpful
[22:43:31] <tripflex> should give you exactly what you want
[22:43:44] <sephreph> awesome, thanks so much!
[22:43:45] <tripflex> project will basically reformat the document and return the document to you ow you specify
[22:43:58] <tripflex> but that video gives you a real world example
[22:44:08] <sephreph> sounds like what I need :D
[22:45:18] <tripflex> :P good luck
[22:45:28] <tripflex> aggregation was one of the hardest for me to wrap my head around (still kinda is)
[22:45:49] <tripflex> but once you havea good understanding of how it works and the available methods it makes it a lot easier to develop a plan
[22:45:57] <tripflex> i swear i watched that youtube video 30 times
[22:46:24] <sephreph> Yea, I've found the learning curve a bit steep but it really lets me get data out of the collections that I didn't think I could get out without processing it on the frontend, so I'm glad it exists!
[22:47:07] <tripflex> yeah, project will be one of your most used then
[22:47:12] <tripflex> if you read that first blog post i crated
[22:47:33] <tripflex> it shows how to take a document of products and return a new document with the count of each manufacturers product
[22:57:30] <tripflex> sephreph: here, you will probably find this useful
[22:57:32] <tripflex> https://gist.github.com/tripflex/0e100786e70d31f76046
[22:57:41] <tripflex> it's the videos from the cert class i took a little while back
[22:57:45] <tripflex> oh and if you didn't already know
[22:57:49] <tripflex> http://education.mongodb.com
[22:57:51] <tripflex> free.
[23:06:17] <sephreph> sorry phone call. Oh that's awesome, thanks!
[23:10:26] <tripflex> yup good luck