PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 9th of December, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[05:53:29] <mark___> may i know what is shard???
[05:56:16] <joannac> mark___: http://docs.mongodb.org/manual/core/sharded-cluster-shards/
[05:56:44] <mark___> sharding means to distribute the writes to many machines
[05:57:52] <joannac> mark___: well, distribute the load (writes/reads/disk space/etc)
[05:58:48] <mark___> joannac: means if i have thousands of collections so that i can do shard to maintain the balance
[06:12:43] <mark___> replication means???
[07:58:19] <mark___> http://www.slideshare.net/ranman96734/replication-28997225?from_search=6
[07:58:33] <mark___> can anyone explain me didnt get the slide please
[08:00:53] <bin> anyone from here working with docker
[08:00:54] <bin> ?
[08:34:55] <kephu> hi
[08:36:55] <kephu> I got a bit of a noobish question: I want to write a backend-to-a-game sort of a system, with badges and achievements and such. Being new to mongodb, I wonder, if it's better to store badges and achievements as sub-documents to the user document, or their own collection?
[08:37:42] <kephu> if it helps, I'm expecting potentially a lot of users, and, at least initially, just a couple of achievements
[08:38:21] <kali> kephu: you need to think your data in terms of queries instead of statically
[08:39:22] <kephu> kali: like I said, noobish question ;) How would I approach that from the query standpoint?
[08:39:24] <kali> kephu: try to figure out what the most frequent queries will be, and what layout will be optimum
[08:40:49] <kephu> kali: well when you put it like this, the "embedded doc" seems like the way to go. But then again, there's gonna be a dashboard component to it
[08:41:30] <kali> i dont know what that means :)
[08:42:27] <kephu> well, like an administrative bit that lets you see how many users have achievement x, which ones are consistently topping the leaderboards, stuff like that
[08:42:49] <kephu> preferably with nifty diagrams and whatnot, but that part's on me entirely :P
[08:44:42] <kali> well, if it is on the administrative size, the scalability is less critical. i assume most stuff will be achievable with the aggregation pipeline or map/reduce, but that may be too slow for your taste
[08:44:48] <kephu> another noobish question, then: does mongo allow me to group by username, and then by achievement type? Provided the layout's like {username: 'some_user', achievements: [{name: some_achievement, ...}, ...]} ?
[08:45:04] <kali> denormalizing the required keys figures may help
[08:45:18] <kali> and yes, that is what the aggregation pipeline is about
[08:45:34] <kephu> will probably have to look into that then
[08:46:01] <kephu> anyway, thanks ;)
[08:50:04] <bin> anyone from here working with docker
[10:27:16] <Quest> hi
[10:27:50] <Quest> how relations are made in mongo db? like i have 2 tables, person and person_address . how do I get the addres of the person?
[10:28:19] <Derick> by doing two queries
[10:28:34] <Derick> or, redesign your schema so that the address is embedded in the person documents (prefered)
[10:29:01] <Quest> Derick so in the second case, ALL the data will be in one table?
[10:29:15] <Derick> one collection, yes
[10:29:29] <Quest> so there are no JOINS in mongo?
[10:29:38] <Derick> no
[10:29:44] <Quest> k
[10:29:58] <Quest> why putting all data in one table is prefferd?
[10:30:09] <Quest> why not normalize or use 2 or more qureies
[10:30:42] <Derick> because in MongoDB you store your data from an applications point of view, and it makes no sense to do two queries if you don't need to.
[11:46:44] <Quest> Derick thx
[11:49:08] <richthegeek> I've got some badly-saved data in my db (numbers stored as strings) and I'm wanting to do an aggregate $sum on these fields - is there any way to make it work (ie, make the driver assume that $sum fields should be at least considered as numbers) or is there just no way?
[11:51:13] <Nodex> richthegeek : I don't think there is a way, on the plus side you can just loop it and fix the data
[11:51:28] <richthegeek> loop it?
[11:59:53] <thelucid> Hey, getting "failed with error 16550: "not authorized for query on xxx"", anyone got any ideas, desperate!
[12:00:33] <joannac> thelucid: authenticate with a user with the right permissions for what you want to do?
[12:01:31] <thelucid> @joannac: I have... using Mongoid. I can auth manually and select the relevant entries.
[12:01:55] <thelucid> Moped is raising Moped::Errors::QueryFailure
[12:07:31] <Nodex> richthegeek : loop over your data and fix it
[12:16:17] <bin> guys any idea how i can pass rs config file
[12:16:20] <bin> from outiside
[12:30:58] <bla> I want to create a collection with distinct entries of a field from other DB.
[12:31:16] <bla> Previously on few fields I did .distinct() and then using a loop just reinserted into new DB
[12:32:00] <bla> But now distinct fails on 16mb limit and I've got no idea how to do it - except for writing external software.
[12:33:08] <ranman> bla: internally distinct creates a document and if there are more than 16mb worth of distinct values it's going to hit the document size limit
[12:33:46] <ranman> so yes, you may need to just write some external python script
[12:34:08] <bla> Can I create a collection with unique index on value and use map reduce to fill it?
[12:34:35] <ranman> sure but I would suggest doing it in batches rather than trying it all at once
[12:48:55] <emans> приветствую! есть русско-язычные?
[13:25:16] <bin> anyone alive ?
[13:25:19] <Derick> bin: IRC is asyncronous - ask your question, and somebody will answer when/if they can
[13:25:35] <sflint> aasd123....mongodb is single threaded....and mongo is fit for production and used at many companies in production.
[13:28:29] <bin> haha good call : )
[13:28:47] <kali> sflint: mongodb is multi threaded
[13:28:57] <bin> so can i provide rs conf file automatically without connecting to mongo and invoking rs.initiate()
[13:29:40] <sflint> kali : what makes you think that?
[13:30:44] <kali> the locks :)
[13:30:59] <kali> if it was single threaded, there would be no need for locks
[13:31:52] <kali> also, run a top showing thread on a a system where mongodb runs... that will not leave much place for doubt
[13:32:05] <kali> or you can check out the code, or even the logs
[13:32:32] <kali> or the past issues with stack sizes...
[13:32:48] <kali> -> it IS multi threaded.
[13:33:50] <Derick> definitely multithreaded
[13:34:45] <bin> so i guess my question is not clear or noone knows ..
[13:35:16] <Derick> bin: the configuration lives in the servers, not in config files
[13:35:33] <bin> so i cannot pass a file in json forma ..
[13:35:35] <bin> format
[13:35:36] <Derick> bin: it has to be in config files to make adding new nodes easier... and not have stale config files all over the place
[13:35:41] <Number6> bin: you need to rs.init, as this creates the oplog
[13:35:41] <Derick> bin: nope, you can't do that.
[13:36:01] <bin> so the only way to configure rs is within mongoshell
[13:36:39] <Derick> bin: it has to be in config files << that made no sense
[13:36:51] <Derick> bin: it has to be in the replicaset config on the servers to make adding new nodes easier... and not have stale config files all over the place
[13:37:25] <bin> sorry mate i dont get it
[13:37:33] <bin> what you mean is rs.conf() right
[13:37:39] <Derick> yes
[13:37:43] <Derick> it needs to be done thorugh there
[13:37:48] <bin> i see
[13:37:51] <bin> thank you
[13:37:52] <bin> :)
[13:37:53] <Derick> each node will get a copy of that config
[15:12:38] <bin> guys if i have 2 machines
[15:12:45] <bin> which means 2 members in a replica set
[15:12:50] <bin> how do it put arbitar ?
[15:16:26] <Joeskyyy> bin: http://docs.mongodb.org/manual/tutorial/add-replica-set-arbiter/
[15:17:34] <bin> well this explains setting an arbiter on one of the machines right
[15:17:58] <Joeskyyy> Correct, is that not what you were asking?
[15:18:02] <bin> no no ,
[15:18:12] <bin> because you set every member on a different machine
[15:18:34] <bin> but i have only 2 machines
[15:18:40] <bin> with 2 members and 1 arbiter
[15:18:41] <Joeskyyy> Well, you don't necessarily have to, you can run your arbiter on the same machine as another
[15:18:49] <bin> well i know that
[15:18:53] <Joeskyyy> You just need to start the mongod proc on a diff port.
[15:18:54] <bin> but what if the machine goes down
[15:18:58] <Joeskyyy> Gotcha.
[15:19:04] <bin> it will be done with the member and the arbiter
[15:19:09] <bin> and i m left only with 1 member
[15:19:20] <Joeskyyy> Right, and your repl set will go offline since there's not a majority.
[15:19:31] <bin> well i guess read-only
[15:19:34] <Joeskyyy> Right.
[15:19:38] <bin> yup
[15:19:56] <bin> so any idea how i can avoid that
[15:20:00] <bin> but using only 2 physical machines
[15:20:08] <Joeskyyy> Add a few arbiters on each machine?
[15:20:15] <Joeskyyy> Or buy another super cheap machine to run an arbiter haha
[15:20:43] <bin> well i will add 2 arbiters on the first and 1 on the second
[15:20:47] <bin> now i have 5 votes right
[15:20:56] <Joeskyyy> Correct.
[15:21:06] <bin> and no matter which machine dies
[15:21:11] <bin> a new guy will be elected..
[15:21:11] <bin> :D
[15:21:15] <Joeskyyy> Bingo (:
[15:21:26] <bin> nice ;) i will try that at home tonight ;)
[15:21:28] <bin> thanks Joeskyyy
[15:21:33] <Joeskyyy> No prob :D
[16:17:29] <movedx_> Can you place a constraint on a document's fields? For example, can I place a constraint on a field that prevents an integer less than 0 or greater than 100 from being applied, or do I have to do this in software?
[16:19:40] <kali> you have to do it on your side
[16:20:08] <movedx_> That's cool! Makes sense. I was just wondering :)
[16:36:30] <prateekp> hello, i am building a rails appliction . I am using mongodb .... While i am able to access the database from console but the things are not running on the application
[16:38:10] <kali> how does it fail ?
[16:39:39] <prateekp> kali : you can see the error at https://gist.github.com/papriwalprateek/7875432
[16:40:32] <prateekp> PS: i am new to mongodb
[16:40:41] <ron> SURPRISE!
[16:43:20] <kali> prateekp: except being a bit slow, i don't think these lines are errors
[16:44:46] <prateekp> but actually i am able to get access the database through terminal but results are not coming on the web app
[17:38:13] <_maes_> hi, I have a problem with chunks balancing across the shards:
[17:39:04] <_maes_> it started couple days ago with following message in router log:
[17:39:04] <_maes_> "can't move shard to its current location!"
[17:39:05] <_maes_> Could anyone please point me in right direction what it could be?
[18:29:55] <runa> heyas. I imported a million + docs into a collection: imported 1689905 objects
[18:30:06] <runa> but > db.zp.count()
[18:30:06] <runa> 385347
[18:30:09] <runa> why?
[18:42:12] <ericsaboia> hey guys, I need to sort users based on a list of ObjectIds, I'm trying to use aggregation with project to accomplish that
[18:42:24] <ericsaboia> https://gist.github.com/ericsaboia/d6d04109569ce3f19181
[18:42:45] <ericsaboia> But aggregation comparsion operators do not accept "$in"
[18:43:19] <ericsaboia> is there any way to do that without map/reduce?
[18:56:56] <link1511> hey all, i'm trying to diagnose an autoreconnect error with pymongo
[18:57:07] <link1511> i have newrelic on the mongo hosts, and on the host that is querying them
[18:57:18] <link1511> and i don't see anything that looks like an issue in the numbers on the mongo side of htings
[18:57:28] <link1511> but the autoreconnect error seems to indicate that a replica set has failed?
[18:57:38] <link1511> what kind of things should i be looking for to indicate a problem in mongodb
[19:06:48] <lakmuz> have collection {_id: ingridient, productIds: idsofproducts}, need to update this row by add new product id to productIds if exists or create new
[19:07:00] <lakmuz> what is the right way
[19:11:13] <lakmuz> {_id: unique, field: array} how to add to field
[19:11:30] <cheeser> $addToSet
[19:11:35] <lakmuz> ty
[19:24:39] <link1511> how do i force slaves to be read only in mongodb?
[19:27:35] <sharondio> link1511: Slaves? You mean replica sets? Read-only secondary replica sets is the default.
[19:28:58] <link1511> looks like i'm getting write issues
[19:30:48] <sharondio> link1511: write issues? or replication issues?
[19:31:00] <link1511> honestly i cant decipher it, looking for help
[19:31:03] <link1511> i have ganglia on all the hosts
[19:31:05] <link1511> and new relic
[19:31:11] <link1511> and i can't make heads or tails of any of it
[19:31:19] <link1511> except that i get autoreconnect whenever i write new data
[19:31:47] <link1511> and it appears that the writing in blocks / second are equally distributed among my hosts irregardless of master / slave
[19:32:07] <link1511> i have a bunch of statistics on theses hosts but absolutely no information on what might be "bad"
[19:32:15] <link1511> and no real error messages except from the front end
[19:34:21] <link1511> what should i be looking for?
[19:34:30] <link1511> or where should i be looking :\
[19:34:52] <sharondio> Well, you can login and take a look at the rs.status() to confirm that things are setup the way you want them.
[19:34:58] <sharondio> Via the shell.
[19:35:33] <maplebed> Hi, I'm looking for the changelog for the mongo gem. Docs point to https://github.com/mongodb/mongo-ruby-driver/wiki/History but that page doesn't exist. Any suggestions?
[19:36:56] <link1511> kk, so i have htat
[19:37:15] <maplebed> (and by docs I mean http://api.mongodb.org/ruby/current/#release-notes)
[19:37:23] <link1511> i see they have err messages related to syncing to eachother
[19:37:42] <link1511> sharondio: but they seem set up right i have 1 primary and 2 slaves
[19:38:49] <link1511> but why would the slaves be trying to sync to the primary
[19:38:51] <link1511> i'm confused on that
[19:39:27] <sharondio> link1511: Because that's what replica sets do. They replicate.
[19:40:06] <link1511> heh, so i how do i tell whats bringing them down
[19:41:07] <link1511> is that error message indicative of a set going down?
[19:41:16] <link1511> like what can i tell from an error message there saying it was trying to replicate
[19:41:38] <joannac> link1511: the error messages would be helpful
[19:43:24] <link1511> joannac: totally up to help get them to you, what would you need? I'm setting up a pastie of the rs.status() on primary
[19:43:25] <joannac> maplebed: https://github.com/mongodb/mongo-ruby-driver/wiki/_history
[19:43:40] <joannac> link1511: the error messages you see in the logs?
[19:43:57] <maplebed> joannac: that gives me the revision history for the wiki page, not the gem, doesn't it?
[19:44:15] <maplebed> I'm trying to find out what changed between v1.8.2 and v1.9.2 of the mong ogem.
[19:45:42] <link1511> http://pastie.org/8540387
[19:46:03] <link1511> joannac: I can't find any errors in the logs, maybe i'm looking in the wrong place?
[19:47:02] <joannac> link1511: oh, that's fine. all 3 members are up
[19:47:26] <joannac> oh i see. the errmsg is not a real error
[19:47:37] <joannac> don't stress about it
[19:47:50] <link1511> hmm, but i'm seeing probles on the frontend in the form of autoreconnect errors
[19:48:01] <link1511> and i cant find any evedence of them on the mongo hosts themselves
[19:49:12] <joannac> maplebed: https://github.com/mongodb/mongo-ruby-driver/releases
[19:49:36] <joannac> maplebed: sorry, haven't had enough sleep
[19:50:07] <maplebed> joannac: Perfect! Thanks. Any chance you know who could update http://api.mongodb.org/ruby/current/ to point there?
[19:51:18] <joannac> maplebed: i think maybe open a jira ticket under the docs project? or maybe the ruby project
[19:51:28] <maplebed> (lol) ok.
[19:51:35] <joannac> thanks :)
[19:52:13] <joannac> link1511: what's the connection string?
[19:52:41] <joannac> link1511: check the mongod logs to see if there's any "failed connection" or "A thinks B is DOWN" or something like that
[19:52:55] <joannac> link1511: could it benetwork problems between your app and the mongod servers?
[19:56:58] <maplebed> Thanks joannac. Filed as RUBY-709
[20:16:37] <ericsaboia> hey guys, I need to sort users based on a list of ObjectIds, I'm trying to use aggregation with project to accomplish that
[20:16:41] <ericsaboia> https://gist.github.com/ericsaboia/d6d04109569ce3f19181
[20:16:47] <ericsaboia> But aggregation comparsion operators do not accept "$in"
[20:16:50] <ericsaboia> is there any way to do that without map/reduce?
[20:22:27] <dnsdds_> I have an array of documents I want to insert to a collection with a unique index. Some documents are identical to existing documents, some aren't. What's the path of least resistance to insert only the ones that aren't already there?
[20:26:38] <luimeme> hello
[20:27:34] <luimeme> i try to do an upsert it work well except it remove a field that is on the document but not in the value i upsert how can i update only the field of the upsert and leave the other intact please
[20:28:58] <Joeskyyy> dnsdds_: you mean something like upset?
[20:29:00] <Joeskyyy> http://docs.mongodb.org/manual/reference/method/db.collection.update/#upsert-parameter
[20:29:50] <Joeskyyy> luimeme: I Think you're looking for the $set operator
[20:29:51] <Joeskyyy> http://docs.mongodb.org/manual/reference/operator/update/set/
[20:30:07] <dnsdds_> Joeskyyy: update() modifies an existing document. I want to insert new ones
[20:30:18] <Joeskyyy> Ah, sorry, misread (:
[20:30:54] <luimeme> Joeskyyy, i use $set but it delete one of my field
[20:31:19] <luimeme> Joeskyyy, db.hosts.update({'name': id},{'$set' : data },True)
[20:31:25] <dnsdds_> Essentially, I have incoming documents with a single field called "tags" that have CSV data in them ("foo, bar, derp"). I split it with ", " to make an array of tags, and I want to add each tag as a separate document in my tags collection
[20:32:01] <dnsdds_> I can do a bulk insert, but what if "foo" already exists? Doesn't that mean that "bar" and "derp" won't get inserted because the unique flag failed for the first one?
[20:37:33] <luimeme> nevermind i was something else :)
[20:37:51] <Joeskyyy> Mind sharing?
[20:38:36] <Joeskyyy> dnsdds_: Can you expound a bit more? Are you just adding "foo" "bar" and "derp" to a general tags collection, and checking to see whether any of them exist?
[20:39:28] <Joeskyyy> i.e. in your tags you currently have "foo" "bar" "cats" , so if you sent in "foo" "bar" and "derp", it checks to see which of those exists, if it doesn't exist, insert it? (in this case "derp")
[20:39:54] <dnsdds_> Joeskyyy: That's the gist of it, yes
[20:40:45] <dnsdds_> Joeskyyy: But I'm guessing there should be a smarter way to do that than to just loop over the array and separately .find() each tag and .insert() if it doesn't exist
[20:40:56] <Joeskyyy> Are your tags just stored in an array of some sorts in mongo?
[20:41:37] <Joeskyyy> If so I'm hinting at $addToSet if that's a possibility
[20:41:38] <dnsdds_> Joeskyyy: in the actual items collection, it's just a CSV-style String for presentational purposes. In "tags", it's separate document for each tag
[20:41:46] <Joeskyyy> Gotcha.
[20:41:47] <Joeskyyy> Hmm.
[20:41:52] <Joeskyyy> Brain fart mondays (:
[20:42:01] <dnsdds_> Tell me about it
[20:42:29] <Joeskyyy> Let me chug another cup o' joe and I think I can mash together my thoughts
[20:43:43] <dnsdds_> Alright :)
[20:44:11] <dnsdds_> I just find the bulk insert so handy, there must be a way to ignore any unique errors and just press on
[20:44:14] <dnsdds_> ...right?
[20:47:36] <Joeskyyy> I'm not 100% on the bulk insert thing, mayhaps someone else in the room is?
[20:48:56] <cheeser> what driver?
[20:49:28] <joannac> If they're documents, and you have a unique index, it should be fine?
[20:50:09] <dnsdds_> I'm doing it in Node.js
[20:52:10] <dnsdds_> "Drivers have a ContinueOnError option in their insert operation, so that the bulk operation will continue to insert remaining documents in a batch even if an insert fails."
[20:52:14] <dnsdds_> Intriguing...
[20:56:21] <Joeskyyy> kind of a janky workaround but 2.4 has a setOnInsert when running an update, I'm not sure how fast this would get you but it does work
[20:56:22] <Joeskyyy> http://docs.mongodb.org/manual/reference/operator/update/setOnInsert/#op._S_setOnInsert
[20:56:48] <Joeskyyy> > db.example.update({tag:"derp"}, {$setOnInsert: {tag:"derp"}},{upsert: true})
[20:57:03] <Joeskyyy> > db.example.find()
[20:57:03] <Joeskyyy> { "_id" : ObjectId("52a62dcb099e61800c3977cf"), "tag" : "derp" }
[20:57:17] <Joeskyyy> Running it again only returns the same document
[20:57:35] <Joeskyyy> Unless you can get that ContinueOnError to work :D
[21:08:27] <dnsdds_> Joeskyyy: [MongoError: E11000 duplicate key error index: plusminus.tags.$name_1 dup key: { : null }]
[21:44:33] <qswz> If you directly map user/clients json requests (like that: [action, token, collection, json1, json2]) into mongo queries, what are the potential danger? given that 1- collections names are prefixed with "test.", 2- only 3 mongo methods accepted: find, remove, update (upsert mode), and 3- there is an access, update and remove-rights for documents
[21:44:58] <qswz> the danger I still see is people doing extremely long queries
[22:39:20] <ericsaboia> hey guys, I need to sort users based on a list of ObjectIds, I'm trying to use aggregation with project to accomplish that
[22:39:25] <ericsaboia> https://gist.github.com/ericsaboia/d6d04109569ce3f19181
[22:39:30] <ericsaboia> But aggregation comparsion operators do not accept "$in"
[22:39:35] <ericsaboia> is there any way to do that without map/reduce?
[22:42:20] <cheeser> why not use a $match after the $unwind ?