PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 23rd of January, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[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:13:26] <joannac> try {"owners": {$exists: '...'} }
[00:16:37] <NaN> it returns all the documents > db.users.find({ 'owners': { $exists: 'AXD0003443'} })
[00:16:49] <NaN> even the ones where that owner isn't in the list
[00:23:25] <NaN> ({ 'owners.AXD0003443':{ $exists : true } }) did the trick
[00:23:27] <NaN> thanks joannac
[00:29:10] <rcombs> ohai joannac
[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:15] <uhu> hi gents
[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:01:01] <uhu> :L:(
[01:18:50] <Pinkamena_D> what is wrong with this query that it does not change the value of printers?
[01:19:00] <Pinkamena_D> db.printers.update({printer:"S130"},{$set:{printer:"S130L"}},{multi:true})
[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:36] <synth_> perfect!
[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:02:29] <joannac> yup, update
[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
[02:47:06] <synth_> ruphos thank you!
[02:47:11] <synth_> sorry, late response
[03:29:50] <khimera> hi...anyone using ming/python here
[06:48:12] <tjj> If I have a query like find({"a": "123", "b":"456"}).sort({"c":1}), what index should I create to make this query fast?
[07:31:57] <AlecTaylor> hi
[07:36:01] <AlecTaylor> What MongoDB ORM-like layer would you recommend? - http://api.mongodb.org/python/current/tools.html#orm-like-layers
[08:19:15] <calabi> hello
[08:21:19] <ncls> calabi: hello
[08:22:02] <calabi> im having a mission trying to get MMS running on server 2012 R2, it seems to install python fine but then i get
[08:22:07] <calabi> Valid python install not found. Service not installed
[08:22:19] <calabi> ive had a read of a couple blog posts
[08:22:36] <calabi> but no luck
[08:22:52] <calabi> http://tech.valgog.com/2010/01/after-installing-64-bit-windows-7-at.html
[09:06:02] <calabi> does anyone actually talking in this chanel or just join and quit?
[09:06:14] <calabi> *talk
[09:06:42] <BurtyB> hmmm yes
[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
[10:51:13] <Veejay> My bad
[10:51:48] <mark__> i didnt get the aggregation ???can you please help me to get the concept
[12:42:26] <ells> hiya guys
[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:02] <Rakan> Hello guys
[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.
[14:49:07] <Rakan> Gargoyle: sounds great... thanks
[14:50:22] <puppeh> I get this error on my Mac when doing mongod: http://pastie.org/private/6dsgaykagpkd7pdpf66zgq
[14:50:24] <puppeh> any ideas?
[14:51:58] <Gargoyle> puppeh: You imported data files from somewhere else?
[14:52:03] <puppeh> yes
[14:52:20] <Gargoyle> Looks like you have a case-sensitivity issue.
[14:52:27] <Gargoyle> Local vs local
[14:52:35] <puppeh> ok so what should I do?
[14:53:09] <Gargoyle> Not 100% sure, I've always tried to run my mac case sensitive!
[14:54:55] <Gargoyle> have you got multiple local files in /usr/local/var/mongodb
[14:58:29] <puppeh> yes
[14:58:35] <puppeh> can I remove them? i don't care if i lose data
[15:20:25] <module000> does the mongo client's built-in help contain help for admin functions? (eg: db.addUser() )
[15:24:24] <cheeser> db.help()
[15:24:24] <cheeser> DB methods: db.addUser(userDocument)
[15:24:29] <cheeser> so, no.
[15:24:44] <module000> cheeser: that's what I was wondering, thanks
[17:06:50] <Kaim> hi all
[17:06:56] <paulkon> hi!
[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:47:10] <cheeser> sure. db.collection.update({}, { $set : { key : value} }, false, true );
[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:14:25] <Joeskyyy> relevant: https://jira.mongodb.org/browse/SERVER-7548
[18:16:08] <omid8bimo> Joeskyyy: i dont know what should i do. restarting didnt help. also i tried --repair but failed again
[18:16:22] <Joeskyyy> What version are you running?
[18:17:33] <omid8bimo> Joeskyyy: 2.4.4
[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:24:45] <omid8bimo> right
[18:24:47] <omid8bimo> ?
[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:29:08] <Desert_> i see all sequential access
[18:29:13] <Desert_> im using c++
[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:37:55] <Joeskyyy> Including the balancing.
[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:46:48] <Joeskyyy> Yeahhh
[18:53:13] <Desert_> Joeskyyy: otoh, i have a command { distinct: "testData", key: "album" } and it works
[18:54:25] <Desert_> then i create in c++ BSON("distinct" << "testData" << "key" << "album" );
[18:54:41] <Desert_> it turns to { distinct: "testData", key: "album" }
[18:54:44] <Desert_> but i get
[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:27:35] <ThePrimeMedian> logic*
[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:32:48] <NaN> so I have 'replies': [{...}]
[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?
[20:42:01] <NaN> mmm
[20:56:07] <synth_> http://pastebin.com/sGVSP8ux does anyone have an explenation as to why the keys got reordered the way they did?
[20:56:49] <synth_> just curious, really.
[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.
[21:51:50] <Joeskyyy> An hour latter haha
[22:00:52] <synth_> Joeskyyy Okay, interesting. Thanks
[22:01:06] <Joeskyyy> No prob.
[22:21:20] <heny> hey, i'm trying to group from mongodb using linq. the query is like this: http://pastie.org/8661777
[22:21:42] <heny> unfortunately the result only shows "The GroupBy query operator is not supported."
[22:21:47] <heny> any way to fix this?
[22:22:34] <heny> the type of the query result is IEnumerable<IGroupable<string, Bogenantwort>> but it only contains the error
[22:36:03] <Joeskyyy> heny: I'm pretty sure groupby isn't supported since there's no mongoDB equivalent query
[22:36:15] <Joeskyyy> http://docs.mongodb.org/ecosystem/tutorial/use-linq-queries-with-csharp-driver/ <- Last point under "Quickstar"
[22:36:24] <Joeskyyy> Quickstart* even
[22:37:48] <heny> hmm.. how can i then do what i want to do?
[22:38:08] <heny> process the query manually in a loop?
[22:39:31] <heny> or wait, can't i get an iqueryable with all items and then use another linq query just on that iqueryable?
[22:46:39] <NaN> can I update multiple values in a single 'update'? or do I need to do update for each value that I want to update?
[22:48:11] <Joeskyyy> You can do multiple, just comma separate them
[22:49:57] <Joeskyyy> Here's the docs for reference: http://docs.mongodb.org/manual/reference/operator/update/set/
[22:50:09] <NaN> nice
[22:50:11] <NaN> thanks Joeskyyy
[22:50:28] <Joeskyyy> No probs
[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.
[22:57:01] <Joeskyyy> :\
[22:57:15] <heny> alright, thanks anyway
[22:57:31] <heny> but i guess the problem now is just my linq group by statement
[22:57:38] <heny> which has nothing to do with mongodb anymore
[22:57:50] <heny> the newAnswers has all the elements i need
[22:57:54] <heny> just need to group them right ;)
[23:10:37] <heny> Joeskyyy: my group by was right, visual studio just displayed it weirdly in the watch
[23:10:42] <heny> so thank you ;)
[23:10:51] <Joeskyyy> No problem :D
[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:27:38] <future28> C, python
[23:27:48] <Joeskyyy> i like your style
[23:27:49] <future28> But I can write js fairly well and ruby too, it's just been a while haha
[23:27:54] <future28> Thanks!
[23:29:09] <Joeskyyy> You'd want to probably use python's readLine() to grab the line from the file
[23:29:10] <Joeskyyy> http://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects
[23:30:04] <Joeskyyy> Then, with the pymongo drivers for python, store that in mongo db with something like db.lines.insert({'content': linevariable})
[23:30:15] <Joeskyyy> http://api.mongodb.org/python/current/
[23:30:19] <Joeskyyy> There's the info for pymongo
[23:30:35] <future28> Sure, so say I had a 100 line file, and iterated over each line, would it just append the line to the 'content' field?
[23:31:41] <Joeskyyy> Store it in an array, for each item in the array, store the item.
[23:31:44] <Joeskyyy> Done and done.
[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
[23:33:21] <Joeskyyy> :D
[23:34:01] <Joeskyyy> IIRC readlines() reads all the lines into a list by default.
[23:34:25] <future28> Awesome, thanks again!
[23:34:30] <Joeskyyy> no prob