[00:06:31] <NaN> on this shcema > http://pastie.org/private/v7reibqkvykd7psyomg << how can I fetch all the documents with owner = AXD0003443 , I tried db.users.find({'owner':'AXD0003443'}) but returns nothing
[00:11:44] <joannac> You're trying to match on a key rather than a value?
[00:12:20] <NaN> yes it's a key, in some documents 'owners' has more than 1 "owner"
[00:54:16] <edude03> For example, this https://gist.github.com/edude03/b77802393ba47c0dfe82, could I use $all find recipes that have Green Kale and Garlic?
[01:00:25] <uhu> say I wana create a 4th node for a replicaset
[01:00:59] <uhu> can I jsut bring up new mongo and then with same config fiel indicating same replicatset start it and it will suck in all 200G data? i tried i one time but cmongo kept stpping
[01:48:16] <synth_> hello, i'm new to mongo and i'm currently testing it out using a php driver. i've entered over 100 entries into a database collection which i can query via php, however i'm not seeing the data entered via command line. when connecting, i do: $this->_connection = new Mongo("localhost"); then $this->_db = $this->connection->pipeline; $user_collection = $this->_db->users; this database has info
[01:48:16] <synth_> in it but when i go to my shell and run "mongo" i get an interactive shell that shows the pipeline database when running "showdbs", however, db.pipeline.find() returns: { "_id" : ObjectId("52e0596e6ca0b5d61369e22f"), "users" : [ ] }. any ideas?
[01:55:49] <joannac> if pipeline is your db and users is your collection, you want
[01:55:55] <joannac> use pipeline; db.users.find()
[01:57:48] <synth_> for some reason it was defaulting to "test"
[01:57:56] <synth_> i didn't know about the use _db_ command
[02:02:01] <synth_> so if a user exists, example: { "_id" : ObjectId("52e074d91bcfc5ca4dcb5796"), "uid" : "david.hochstadter", "name" : "", "phone" : "", "email" : "" }; am i able to add more keys to that entry later on? like if wanted to later store like a "address" key
[02:06:50] <synth_> interesting. i'll read through the api. thanks for your help!
[02:09:09] <synth_> from docs: db.bios.update( { _id: 3 }, { $unset: { birth: 1 } } ) ---- if doing this in php, $unset would be considered a variable. would i have to do array('$unset' => array("birth" => 1)) ?
[02:12:58] <ruphos> synth_: yeah, just use single quotes around the $operators so php doesn't try to interpret it
[09:54:23] <[AD]Turbo> is it possible to use the dot-notation to update sub-sub-arrays like slots[i0].dailyStats[i1] with 'slots.' + i0 + '.dailyStats.' + i1 ? is it valid?
[09:58:55] <kali> [AD]Turbo: it should work. what is problematic with double nested arrays is the positional operator ($)
[10:00:12] <[AD]Turbo> kali, thx so my query should be safe because i don't use the $
[10:00:44] <[AD]Turbo> so the dot-notation could be nested as I desire to index sub-arrays, sub-fields and so on?
[10:01:39] <tagrudev> hello guys/girls I want to export my database to json format and limiting the number of items in each collection is that possible
[10:01:50] <tagrudev> without specifying a collection
[10:02:44] <tagrudev> I am currently using mongoexport --host localhost --db a --collection b | head -5 > a.json
[10:13:37] <asido> I have a problem trying to perform field $sum operation on a collection with ~100k documents. If I query the collection first minimizing the document count to a couple hundred, it works fine, but performing same query on 100k documents throws SocketException "No such host is known" (C# driver)
[10:14:01] <asido> I tried setting socketTimeoutMS and connectionTimeoutMS to 100s, but no difference
[10:49:52] <Veejay> Hi, there's a command like printReplicaSetInfo or something, I can't remember what it is and I'm failing at google-fu hard, does it ring a bell for anyone?
[10:51:11] <Veejay> db.printReplicationInfo(), I was trying to call it on the replica set instead
[12:42:47] <ells> Q: When you set a mongodb host to "hidden", it's up to the client to obey that flag?
[13:22:10] <Veejay> Hello everyone, one of the secondaries in our replica set went down this morning and we've noticed that when it went back up again, the primary reopened all of the databases one after another (most likely to resync the secondary with "fresh" data) which I think had a bad effect on our application
[13:23:02] <Veejay> Is there a way to maybe tune the resync process so that it doesn't prevent the primary from functionning properly while the resync is happening?
[13:23:43] <Veejay> Note that my understanding of all this is somewhat hand-wavey for now, if there's some doc I could read or something you know of, I'd be glad to give it a shot
[14:15:32] <Rakan> Since capped-collections delete old data when size, max number of rows are reached... is there a way to archive the old data rather than deleting them?
[14:15:50] <Rakan> I couldn't find anything in the documentation that discusses what happens when max is reached
[14:38:44] <Gargoyle> Rakan: That's the whole point of a capped collection. If you want to keep the data around, don't put it in a capped collection.
[14:39:17] <Rakan> Gargoyle: yea but i guess the performance gain in capped-collections is worth it
[14:39:38] <Rakan> Anyway, i'll add an indexed date field and get on with it
[14:40:05] <Gargoyle> You get the performance by not keeping old data. You could always write the data to two collections or two databases.
[14:40:20] <Gargoyle> then query the capped one when you just want quick access to recent stuff.
[17:07:04] <Kaim> is it possible to set weight on some shard in a mongo shard cluster ?
[17:07:16] <Kaim> or to not insert data on a special shard
[17:15:31] <asido> I am using a C# driver and noticed that when I do queries which are heavy to execute I get SocketException with message "No such host is known". for example I perform $sum query on one field and if the result temp collection contains a couple hundred documents it works fine, but if I have 100k documents I get that exception
[17:21:00] <bhangm> I have a replica set in which I shut down and remove a secondary for maintenance. When I restart the secondary in standalone mode, clients continue to connect to it and I see queries coming in as well. Any idea why ?
[17:44:19] <synth_> is there a way to update all documents in a collection to contain a new key/value pair?
[17:49:55] <synth_> could i post some of my code and someone tell me if there's a better way of doing what i'm doing?
[17:50:48] <Desert_> i installed mongodb-10gen using the ubuntu instructions, but how do i get the *-dev package to get the includes and use the C++ clients ?
[17:51:07] <Desert_> there is no mongodb-10gen-dev. And the ubuntu version conflicts
[17:52:45] <synth_> http://pastebin.com/GqU9aR2D is there a better/smarter way I could do this? (i'm new to mongodb)
[18:07:33] <omid8bimo> help please. my mongodb stopped working with this error http://paste.debian.net/78038/ . what should i do now?
[18:12:34] <Joeskyyy> line 21 is where you're having the hangup at omid8bimo. Looks like the object size is invalid
[18:18:26] <Joeskyyy> Might be a bug, might be something in the document you're trying to store/replicate, but that's the line that's causing it to fail out.
[18:18:50] <Joeskyyy> *shrugs* Bit hard to tell honestly. Unless someone else has a clue.
[18:20:45] <omid8bimo> i have debian repository binary installed. i dont know if i can remove it and install from 10gen's repository itself.
[18:21:22] <omid8bimo> Joeskyyy: so its not a file or something that i can remove and start again right?
[18:23:31] <Joeskyyy> I'm going to assume no, because it shouldn't have inserted that object anywhere.
[18:24:44] <omid8bimo> Joeskyyy: all right. so i guess my only solution is to remove the data path and restore from backup and wait for db to catch up with replication
[18:25:13] <Joeskyyy> That's the most obvious and probably quickest solution I can think of yeah.
[18:27:48] <rickibalboa> I'm tailing the oplog to monitor for some changes on collections, will the oplog be spammed when a shard balances? Is there a way to ignore these events?
[18:29:02] <Desert_> can i have a query and access it randomly? to get the i-th elment ?
[18:30:57] <Joeskyyy> rickibalboa: I can't imagine you'd want to?
[18:31:35] <Joeskyyy> Desert_: You mean you want the i-th element of a cursor return from a query?
[18:31:46] <Joeskyyy> i.e. a db.test.find() returns 5 docs, you want the 3rd doc?
[18:31:53] <rickibalboa> hmm, maybe you're right, although it can provide a hell of a lot of traffic I don't want to be bogged down from it just showing inserts on docs I've already got?
[18:37:11] <Joeskyyy> rickibalboa: I think you may want to look at what the oplog is used for, all those inserts are fairly important to mongoDB's replication process — http://docs.mongodb.org/manual/core/replica-set-oplog/
[18:41:49] <Desert_> Joeskyyy: yes, im populating a list model that requires incremental access
[18:42:05] <Desert_> Joeskyyy: but semi-random, it's a listview
[18:42:49] <Joeskyyy> My immediate thought is use db.test.find().limit(1).skip(i-1)
[18:42:53] <Desert_> Joeskyyy: yes, i need the 5th doc, i was populating the full list in the ui but now i have hundreds, then the view is requesting only those visible
[18:43:13] <Desert_> Joeskyyy: i found that, but wouldnt that make lots of calls, is it a good practice ?
[18:43:27] <Joeskyyy> Depending on where in your program you're using it.
[18:43:39] <Joeskyyy> If it's somewhere in like a for loop or something, you're gonna have a bad time.
[18:43:49] <Joeskyyy> Because that scans all documents, just to return the one doc.
[18:44:04] <Desert_> the ui requests data for a single element, everytime you scroll the listview
[18:44:07] <iwantoski> So I have a question (super new to big table dbs). Lets say I have a simple blog. User can post an article. From what I read, one should strive to not keep multiple collections. But if I "copy" data from user to my post collection (like, written by) to avoid "joins" so to speak - and then i.e. change the user.name, how do I manage this within the post collection??
[18:44:45] <Desert_> Joeskyyy: i have about 10 visible elements, but fetches about 2-3 before and after
[18:45:10] <Desert_> Joeskyyy: if you scroll and do kinetic scolling of the ui, then you might get lots of requests
[18:45:16] <Joeskyyy> Yeah I'd hate to make your program implode with slowness.
[18:45:36] <Joeskyyy> The other thing that came to mind was store all the returned docs in an array, then call the array in your program instead.
[18:45:43] <Joeskyyy> But, that too can be innefficient.
[18:45:58] <Desert_> imagine hundreds, or thousands
[18:46:13] <Desert_> this is a karaoke system with proably a thousand albums
[18:46:36] <Desert_> i cant have the whole album data on memory
[18:54:53] <Desert_> terminate called after throwing an instance of 'mongo::UserException'
[18:54:53] <Desert_> what(): invalid parameter: expected an object (0)
[18:58:43] <Joeskyyy> I'm not familiar with the c++ drivers unfortunately :\
[19:10:18] <NaN> with JS, how can I create a date from a mongo date object? I'm getting obj.sec and obj.usec from a JSON
[19:27:16] <ThePrimeMedian> anyone done "since" instead of pagination in your apps? http://hastebin.com/jahexipiji.sm for most recent (top one), it works great, but when I do it for popular (the bottom one), it doesn't work, it keeps giving me documents even though there aren't any new ones. I may just have the login wrong in my head.. what do you think?
[19:33:26] <Desert_> why does this query wont order the elements? db.runCommand({ distinct: "testData", key: "album", query:{}, "$orderby":{ album : -1 } })
[20:26:46] <mst1228> hey, i asked this on the #mongoosejs channel as well, but it seems less busy. It should be a Mongo core question also. I'm wondering if it's possible to populate a nested array of document ObjectId's?
[20:27:30] <mst1228> example, i have a model called League which has a property 'teams' that is an array of ObjectId's referencing a Team model document.
[20:28:15] <mst1228> in mongoose I can query the League model and do .populate('teams') to fill that array with full objects instead of just the ObjectId's (not sure what this is called in Mongo core)
[20:31:11] <mst1228> that Team model also has an array of ObjectId's that reference a Player model. Is it possible to populate both of those arrays in a single query on the League model?
[20:32:15] <NaN> is it possible to do $push to an object? 'replies' : { 'user1' : { 'msg' : 'hi' }} << push in replies
[20:32:35] <NaN> I tried with $push but it converts the 'replies' to an array
[20:33:38] <mst1228> what would you expect it to look like after the $push?
[20:34:12] <mst1228> if you have more than 1 reply object in the 'replies' property, it has to be an array, no?
[20:35:36] <NaN> no, it will be an object with { 'user1' : {...}, 'user2' : {...} } and so on
[20:36:04] <NaN> because that way I can do queries with replies.user1
[20:37:39] <mst1228> i suspect 'user1' is a username, can you add another property to those objects so you'd have an array like: [ { 'username': 'user1', 'msg': 'hi' }, { 'username': 'user2', 'msg': 'bye' } ]
[20:39:17] <mst1228> then you can query like model.find({'replies.username': 'user1'})
[20:41:57] <NaN> and how do I iterate to show all my users?
[21:09:02] <grexican> what's up all. Got a quick Q. Is there a mongo shell function that can clone a JSON document? I need to clone the json document and add new properties to it, but don't want to modify the orignial. Something like jQuery extend. Some kind of clone.
[21:09:26] <grexican> not sure if mongodb comes with anything built in that I can look at
[21:51:04] <Joeskyyy> synth_: It probably has to do with the padding of a document.
[21:51:21] <Joeskyyy> When you issued the update, it probably increased a size or something similar, and moved it.
[22:55:47] <heny> Joeskyyy, i figured out that it should work. but when grouping via the ienumerable now i only get the key. i'm now using these two queries: http://pastie.org/8661867
[22:56:22] <heny> any idea? i'm not too familiar with all this stuff yet
[22:57:00] <Joeskyyy> I'm not 100% familiar with linq sorry, I just know that you can only use things against mongo that are viable in mongo is all.
[23:10:58] <Joeskyyy> Glad I could be of some help haha
[23:22:38] <future28> Hey, I have just installed mongodb and am wanting to import my data. The data is simply a text file for example: file.txt, and the body is something like "Hello there, this is my first time using mongo." , I would like to import this to mongo db with a unique id. Can anyone give me some tips? I can only find that you can import csv's etc so I am usure how to go about this
[23:26:40] <Joeskyyy> future28: You'd probably just need to a whip up a javascript file, or any other language with a supportable driver for that matter.
[23:26:55] <Joeskyyy> It would read in a line from the txt file, and insert it with the attributes you want.
[23:27:08] <future28> Joeskyyy: Thanks for the tip - Could you point me to an example?
[23:27:22] <Joeskyyy> Have a preferred programming language?
[23:32:06] <future28> Great, makes it sound easy. Thanks for the help, I'll go away and see how I do.
[23:33:21] <Joeskyyy> It's pretty simple. you'll find a lot of the structures you're used to in python are just plug and play with mongo, that's why I like it a lot