PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 25th of August, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:36:55] <energizer> Hello, I'm new to mongodb. I've written some code. I'm guessing there's a better way to do this easy thing, but i'm not sure what it is. Comments show what I mean. http://pastebin.com/0jvRSLgf
[00:37:17] <energizer> (E.g. is the first part of my if-statement redundant here?)
[00:38:30] <joannac> why are you upserting key-value pairs one at a time?
[00:38:42] <energizer> joannac: how am i supposed to do it?
[00:38:51] <joannac> oh wait
[00:39:21] <joannac> can't you build the second half of the update and do it all in one go?
[00:41:14] <energizer> You're saying because it's slow to update the database a lot of times?
[00:45:17] <silasx> Thanks guys your idea worked (to use —excludeCollection)
[00:45:20] <silasx> goodnight
[00:51:02] <Xapht> I have a stored a mongoDb document containing time series data, with counts to calculate averages at each step up/down the tree. How can I construct a query to only return the total and totalCount fields that are nested in the document.. (Example doc https://gist.github.com/hoittr/2292fc2c978db5d95ac5)
[02:31:14] <jmorphin> Hey there. How does mongo fare as a persistence database? I've read some concerning things about data loss and the like, just wondering if it's safe to use as a primary store.
[02:46:48] <dyce> if i index restaurants by zipped what does that do exactly?
[02:46:52] <dyce> can i view unique zip codes?
[03:48:35] <terminal_echo> anyone here to answer question?
[03:49:03] <terminal_echo> 'allow_inheritance': True,
[03:49:23] <terminal_echo> When I query a collection if this is enabled I do not get any results
[03:49:31] <terminal_echo> if I disable it, I get results, but the references are not translated
[03:50:03] <terminal_echo> doing something wrong, maybe I don't understand what this actually does? I assumed this meant that if you setup reference relationships they would automatically be translated in the results of a query?
[03:56:50] <joannac> terminal_echo: are you talking about something like mongoose?
[03:57:26] <joannac> I have no idea what "allow_inheritance" is referring to, there's nothing like that in the server
[03:58:30] <terminal_echo> I was under the assumption references worked like foreign keys in mongo?
[03:59:27] <joannac> http://docs.mongodb.org/master/reference/database-references/
[04:00:24] <terminal_echo> so in my query results, if I have references setup as basically foreign keys, there is no way this is automatically translated?
[04:00:33] <joannac> no
[04:00:58] <terminal_echo> ah, so i have to loop through the results and make those queries? :(
[04:01:12] <joannac> the way it is translated is "your app or your ODM issues another query"
[04:03:00] <terminal_echo> :(
[05:32:09] <energizer> How do I update a db with the entries of a dictionary?
[05:34:15] <energizer> (How do I update a *document*'s fields with the corresponding fields of a dictionary?)
[08:16:05] <synthmeat> at start of my app, i'm accessing db in a way that's uncommon during the actual app lifetime. is there any reason to believe i should purge working set after such operations?
[09:17:23] <Kobbb> Hey guys, does anyone know a good mongodb client running on linux that support mongodb3 ? I can't find a good one :(
[09:29:50] <skullcrasher> what can be the problem if I can connect with "mongo" but not with "mongo mongodb://localhost:27017"?
[09:34:53] <skullcrasher> nvm ... got it
[09:51:25] <synthmeat> 6
[09:51:28] <synthmeat> (oops)
[11:45:18] <izzy_> hi
[11:46:37] <izzy_> im trying to setup mongodb on a cluster, but i get the following error: "errmsg" : "exception: need most members up to reconfigure, not ok : .. code" : 13144,
[11:47:08] <izzy_> now stackoverflow says i cant connect to the other server, while im able to remotely mongo shell to those databases
[12:08:28] <deathanchor> izzy_: did you rs.initiate on only one member?
[12:10:43] <izzy_> no, on both
[12:11:03] <deathanchor> rs.initiate should only be done on one
[12:11:19] <deathanchor> then on that one, you do rs.add() to add the other members
[12:11:41] <deathanchor> it's a common mistake people do when first setting up replicasets
[12:12:29] <deathanchor> just think of it as, there can be only one initiate! it becomes the leader, and the others will follow when added by the initiate.
[12:14:10] <izzy_> how do i undo the rs.config?
[12:16:10] <deathanchor> stop mongod on that member, remove everything under the dbpath and start it back up
[12:16:38] <deathanchor> I assume this is a new setup so no real data is there
[12:22:07] <izzy_> yes it's a clean setup, so i will delete everything under dbpath
[12:26:59] <izzy_> thanks, it works now
[12:40:12] <deathanchor> izzy_: no worries, common newbie mistake. I've made it when I first started working with mongo
[12:40:35] <deathanchor> you never want two members of a set thinking it's the leader or first initiate.
[12:42:00] <izzy_> :-)
[12:43:14] <StephenLynx> mongo update released on the ubuntu repo
[12:44:38] <StephenLynx> released on centOS' repo as well
[13:01:35] <Majidsafaei29> How can I query for all tags in this document: http://paste.ubuntu.com/12192331/
[13:05:49] <richthegeek> hi all, is there anyway to remove a secondary member from a Replica Set without causing a renegotiation?
[13:10:17] <Majidsafaei29> https://stackoverflow.com/questions/32204859/nested-query-in-mongodb
[13:13:17] <asteele> Majidsafaei29 { 'allNews.tags': { $exists: true } } ?
[13:13:39] <cheeser> Majidsafaei29: answered
[13:13:54] <cheeser> asteele: that won't return just those tags fields
[13:14:25] <asteele> oh didnt see select part..
[13:15:56] <Majidsafaei29> asteele: allNews is in list of numbered keys, in javascript terms I could access it by allNews[0].tags (not allNews.tags), so { 'allNews.tags': { $exists: true } } does work.
[13:17:44] <cheeser> Majidsafaei29: read the SO answer
[13:18:03] <Majidsafaei29> cheeser: the answer is not correct.
[13:19:15] <cheeser> when someone gives an answer, saying "it doesn't work" isn't helpful. people generally need actual error messages and/or output in order to diagnose problems. without those details we're all just stabbing in the dark.
[13:20:27] <Majidsafaei29> the answer is correct for this document http://paste.ubuntu.com/12192513/ not for http://paste.ubuntu.com/12192331/ .
[13:20:28] <Majidsafaei29> OS answer returns 0 results.
[13:21:08] <Majidsafaei29> cheeser
[13:28:11] <cheeser> read my follow up. i think that's the best you're going to get with a query.
[13:28:37] <cheeser> even with an agg pipeline, there isn't a way to promote fields up out of subdocs i don't believe.
[13:43:30] <christo_m> HEllo, best way to do autocomplete with mongodb?
[13:43:36] <christo_m> i see people using regex but isnt that slow?
[13:44:33] <cheeser> regexes that don't start with a pattern token can still use indexes
[13:44:48] <cheeser> "foo.*" vs ".*foo"
[13:46:36] <christo_m> cheeser: i wonder if thats sufficient for auto completing tv shows and movies
[13:46:51] <christo_m> it would just suck when there are stopper words like "The" in the beginning or something.. then things won't be matched
[13:47:14] <cheeser> potentially. unless you're doing partial matches where you're finding all words containing that fragment.
[13:47:33] <cheeser> "offi" should return "the office" and "an officer and a gentleman" e.g.
[13:47:42] <christo_m> really?
[13:47:57] <christo_m> hmm, i guess i can try rooted regexps then
[13:48:00] <cheeser> well, it's a design decision. you don't *have* to search that but many systems do.
[13:49:03] <christo_m> im just wondering if it'll be sufficient to find this type of content
[13:49:13] <christo_m> for a product name its fine.. but some tv shows and movies are similarly named..
[13:57:40] <christo_m> cheeser: so how would i do this
[13:57:42] <christo_m> so thta its most accurate?
[14:03:26] <cheeser> regex or fts probably
[14:11:52] <deathanchor> cheeser or GothAlice, do you know if a member in RECOVERING mode still participates in elections?
[14:13:09] <christo_m> cheeser: sorry im noob
[14:13:14] <christo_m> cheeser: Movie.find({ title: { $regex: /^+escape(req.query.terms) } }, function(err, movie) {}); have a feeling this won't work..
[14:13:22] <christo_m> i also have Movie and TV Shows in separate collections.. i guess i have to run 2 find's
[14:13:55] <cheeser> deathanchor: i don't know. sorry.
[14:15:15] <deathanchor> found it in the docs: Members in the RECOVERING state are eligible to vote in elections, but are not eligible to enter the PRIMARY state.
[14:18:20] <Jameswnl> hi, i have a replica set and client is using mongos to access them. the question is that if I enable authentication, will that slow down the data read? Or it will only slow down the initial session establishment, not the subsequent data read? thanks
[14:27:08] <christo_m> cheeser: you dont know?
[14:27:11] <christo_m> true...
[15:06:40] <veek> could someone point me to a src for architecture of mongodb
[15:45:14] <deathanchor> veek: https://www.mongodb.org/about/source-code/ ?
[16:51:16] <stuntmachine> I've got a mongodb setup with a keyFile on each member of the replica set. I just tried to run mongodump from a server that is not a member of the replica set (just a backup file) and I'm getting an error that I believe only started after I configured this keyFile. The error is: 2015-08-25T11:47:59.673-0500 Failed: error getting database names: not authorized on admin to execute command { listDatabases: 1 }
[16:57:11] <stuntmachine> just a backup server*
[20:05:03] <jr3> is it common to enable reading from replicas?
[20:36:12] <cheeser> jr3: common? sure.
[20:37:06] <jr3> cheeser: I guess my question is really, we have a replica set by enabling read replicas, does this distribute reads? or does it all flow through master?
[20:38:37] <kali> jr3: nope. once the initialisation step is done, the client goes straight to a secondary if it is allowed
[20:38:51] <jr3> awesome
[20:39:23] <jr3> kinda worreid about the whole eventual consistency thing but I guess we will try it and see
[20:39:46] <jr3> we're not really write heavy so I think its ok
[20:47:30] <retran> are you a bank, jr3?
[20:48:00] <jr3> yes
[20:48:23] <jr3> :P
[20:48:27] <jr3> dogecoin
[20:48:34] <cheeser> well, whether it goes to secondaries or not is determined by the read preference
[20:51:36] <albertom> When will be mongodb 3.2 released? or an aproximate date?
[20:54:45] <cheeser> https://jira.mongodb.org/browse/SERVER?selectedTab=com.atlassian.jira.jira-projects-plugin:versions-panel
[21:07:17] <albertom> cheeser: a stable release evry six months, counting from 3.0.0 which was on march? so someday in ~sept ?
[21:07:48] <cheeser> there's no official public date
[21:08:02] <albertom> yeah i get that but an estimate
[21:08:07] <cheeser> but that url is where it'll come up eventually
[21:53:51] <Torkable> im trying to pull a specific object out of an array
[21:54:36] <Torkable> wait hold on lol
[21:54:54] <Torkable> ok hmmm
[21:55:05] <Torkable> I have an array of objects
[21:55:30] <Torkable> [ { id: 12345, ... }, { id: 6789, ... } ]
[21:55:42] <Torkable> and I have an array of ids
[21:55:54] <Torkable> lets say I just have ['12345']
[21:55:56] <Torkable> how do I pull that
[21:56:28] <Torkable> I currently have { $pull: { arrayName: { $in: idArray }}}
[21:56:40] <Torkable> actually pulls every object out
[21:56:43] <Torkable> which is bad
[22:03:35] <Torkable> nvm got it
[22:27:15] <diegoaguilar> Hello, I got this aggregation to know "what are the matchplayer documents with same player.id and same matchDate.round"
[22:27:16] <diegoaguilar> db.matchplayer.aggregate(
[22:27:16] <diegoaguilar> { $group : {_id : {"player": "$player.id", "round": "$matchDate.round"}, total : { $sum : 1 } } },
[22:27:16] <diegoaguilar> { $match : { total : { $gte : 2 } } },
[22:27:17] <diegoaguilar> { $sort : {total : -1} }
[22:27:17] <diegoaguilar> );
[22:28:11] <diegoaguilar> how can I obtain "what are the matchplayer documents with same player.id, same matchDate.round, but distinct totalPoints attribute"
[22:28:11] <diegoaguilar> ?