PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 9th of January, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:01:32] <Boomtime> fruitNvegetables: what language are you using?
[00:01:57] <fruitNvegetables> Boomtime: meteor.js, javascript
[00:03:55] <Boomtime> and you have a db.collection.distinct() call right now?
[00:04:27] <Boomtime> let's say you have your 'array' stored in X (eg. X = ["Fruit", "Vegetables", "Beans"] )
[00:04:43] <Boomtime> X.map( function(c) { return { foodCategory: c } } )
[00:05:01] <Boomtime> the databases provides data
[00:05:10] <Boomtime> that is it's job, formatting is a side-effect
[00:05:41] <joannac> its*
[00:05:45] <Boomtime> :-)
[00:23:16] <anybroad_> hi
[00:23:31] <anybroad_> Is it safe to use a field 'id' in a document?
[00:24:00] <vagueBrother> _id and id are not technically the same although it seems a little confusing
[00:25:01] <anybroad_> ok
[00:25:06] <anybroad_> thank you
[00:32:45] <anybroad_> How to store image files? Should I put them into the mongodb document just like a blog (as e.g. in mysql)? Or rather store the sides outside the mongo database and reference to it using an id or filename?
[00:34:06] <anybroad_> well, an edit requires to know what to edit actually
[00:34:07] <harttho> If it's just referential, you could upload it and store the link
[00:34:12] <anybroad_> so you use the id or some other field as unique id?
[00:34:15] <anybroad_> sorry
[00:34:17] <anybroad_> wrong channel
[00:34:53] <anybroad_> harttho: so storing a large file like a image file (high resolution) in mongodb would degrade performance or cause issues? Because I was also discouraged from doing it with a mysql table.
[00:35:36] <harttho> There are services meant for storing images, especially if they're pulled often
[00:36:02] <anybroad_> harttho: oh, this is interesting. How is this called?
[00:36:03] <harttho> s3 or another CDN would be my suggestion to upload the file, then store a link to the image or path
[00:36:12] <anybroad_> harttho: aha!
[00:36:22] <anybroad_> harttho: and when there are multiple resolutions I would do it on deploy / build, right?
[00:36:39] <harttho> Can't answer that without knowing more about your solution
[00:37:58] <harttho> Need to know how/when/how often you're storing/retrieving the images
[00:38:09] <anybroad_> harttho: when I got a large image for zoom but want small thumbnails, I would then as you proposed (sound reasonable), resize those large images also to thumbs and store both on some cdn thing with an id in their filenames
[00:38:19] <anybroad_> and reference to those images using that id in the mongo db document?
[00:38:38] <harttho> sure, each image would have a document that could contain various images sizes
[00:39:53] <harttho> There you can give them meta-data, too
[00:40:18] <harttho> Pretty broad question though, and not necessarily mongo or sql related
[00:41:52] <anybroad_> harttho: yes, I know (my)sql well, but new to mongodb and I want to fully embrace it
[00:42:20] <anybroad_> harttho: So I create a document for the image and sub-document for each resolution with a reference,id or whatever to fetch them as resources from some cdn
[00:42:21] <anybroad_> very nice
[00:42:25] <harttho> If you want to explore saving in mongo, you can check http://docs.mongodb.org/manual/core/gridfs/
[00:42:35] <anybroad_> ah
[00:42:59] <anybroad_> 16MB limit is large, nice. The images don't exceed that size.
[00:43:22] <anybroad_> So I could store them directly, on the other hand, they are served then and it makes more sense holding them as static or prepared assets for some asset offloading proxy (nginx).
[00:43:40] <anybroad_> alright, this is more than just mongodb (as you just said), so I need to find something that fits the performance needs
[00:43:48] <harttho> right
[00:45:10] <anybroad_> harttho: and when a CDN is not needed or cannot be used one would use a cookieless subdomain instead?
[01:06:30] <harttho> Depends on your goal
[01:07:04] <harttho> And how your stack is layed out
[01:21:24] <fruitNvegetables> my db documents all have field "foodCategory", what query can I execute to get documents with the foodCategory field ALONE and no copies?
[01:25:34] <joannac> fruitNvegetables: Boomtime and I already answered that question.
[01:26:11] <joannac> if that answer didn't suffice, please elaborate on what's missing
[01:26:30] <fruitNvegetables> joannac: sorry, didn't see Boomtime's response, gonna check it out.
[01:36:50] <fruitNvegetables> joannac: so basically mongo can't spit out a query in that form I need my application to mutate it? That's fine it just didn't seem that efficient to me and that mongo might be able to do it.
[01:40:55] <alexi5> i have an document about a piece of equipment include its attributes and sub attriutes and want to allow users to comment on the piece of equipment does it make sense to put the comments in array in the document or should i put them in a new collection ?
[01:46:55] <joannac> fruitNvegetables: mongodb is a database; it provides data. there's some formatting that it can do, but you should consider formatting as something you'll need to do app-side
[01:47:31] <fruitNvegetables> joannac: ok, thankyou.
[01:47:49] <fruitNvegetables> joannac: wasn't sure how much formatting it could do for me
[01:48:15] <Boomtime> fruitNvegetables: you *can* get mongodb to do what you want, but in your case the situation is trivial and it would be overkill to get mongodb to do it
[01:48:49] <Boomtime> you have an array of values, and you want an array of key/values where the key is the same for every doc
[01:48:57] <fruitNvegetables> Boomtime: overkill how, as in a complex query relative to simple serve map?
[01:50:34] <Boomtime> fruitNvegetables: if you want mongodb to do it, you will need to use aggregation: http://docs.mongodb.org/manual/aggregation/
[01:51:00] <Boomtime> it's actually quite easy once you know what you're doing, but you'll need to learn that first, good luck
[01:51:36] <fruitNvegetables> Boomtime: .distinct doesn't seem to be in meteor.js api so I might want to do aggregation
[01:52:13] <Boomtime> ah yes, i remember now, meteor is crap
[01:52:44] <fruitNvegetables> Boomtime: it's fun!
[01:53:08] <Boomtime> it's a shame it doesn't expose numerous mongodb functions to you though
[01:53:27] <Boomtime> if it doesn't support distinct, a trivial query operator, you might check it supports aggregation
[01:53:55] <fruitNvegetables> Boomtime: maybe I'm doing something wrong, but it seems to be undefined :(
[01:54:32] <Boomtime> distinct is just a database command, you can always call it directly; http://docs.mongodb.org/manual/reference/command/distinct/
[02:04:39] <anybroad_> ladessa: I was afk :D
[02:05:01] <anybroad_> ladessa: yes, I had to do the same, there can be only one listen line in config.
[02:06:35] <adavia_> is this schema valid? https://dpaste.de/WmnZ
[02:24:52] <alexi5> when would someone choose a document database over a RDBMS ?
[05:33:23] <alexi5> I relational databases , when the schema changes you send ddl commands to the databases to make changes and update table data if necessary when the application is offline. I have heard apps using mongodb can continue running when new documents with different schemas are used. how do app developers manage document change ?
[05:44:18] <joeyjones> alexi5: the schema is at the document-level not at the table-level, so you can add new fields to your documents at any time and programatically handle checking if it exists for that document.
[05:44:54] <alexi5> ok
[05:46:37] <joeyjones> ie. I have a collection that holds book info called "book", and not all documents have a publisher, isbn, author, etc fields. I check at display what exists in the result and use it accordingly
[05:51:12] <joeyjones> alexi5: A document-based database really excels for flattened data with simple query patterns, ie news articles by date.
[10:35:07] <d-snp> hey guys, anyone ever seen this?
[10:35:08] <d-snp> http://pastie.org/9821763#
[10:35:25] <d-snp> this is consistently happening to ~80% of our requests at the moment
[10:35:34] <d-snp> as well as in the mongos client itself
[10:36:59] <d-snp> I can issue the query multiple times, it'll say different shards dropped connections
[10:38:13] <kali> look at the shards logs
[10:40:16] <d-snp> hmm is error key too large a fatal thing?
[10:40:21] <d-snp> I saw that scrolling by
[10:40:50] <kali> mmm i would not think so
[10:42:00] <iamjunejo> What was the login command for irc?
[10:42:02] <iamjunejo> :D
[10:42:40] <d-snp> iamjunejo: you msg identify to whoever is the nickserv
[10:43:42] <d-snp> ah this is annoying, it's super intermittent, a few minutes ago I would get it 80% of the requests, and now none
[10:44:30] <kali> check out the shards uptime
[10:44:48] <kali> see if some can have restart at the time of the issue
[10:45:45] <d-snp> alright, there's some queries I can do that fail more often
[10:46:19] <d-snp> all shards have been up for 160000 seconds
[10:46:50] <kali> that's about two days.
[10:47:14] <d-snp> yeah that sounds right, I did a reboot then
[10:47:21] <d-snp> which fixed the problem.. for two days :P
[10:47:22] <kali> maybe you are maxing the connection pools
[10:47:46] <d-snp> oh that could be, we did a rearchitecting that requires a significant increase of connections
[10:47:57] <d-snp> (we went to database per customer)
[10:48:07] <d-snp> at least.. I think that requires more connections right?
[10:48:32] <kali> i'm not sure
[10:48:37] <d-snp> ok
[10:48:49] <kali> but it's something to check :)
[10:49:42] <d-snp> good that I'm watching these logs now, I think key too large isn't a very nice error, and I know what's causing it :P
[10:49:50] <d-snp> (it's keys that are too large!)
[10:49:54] <kali> :)
[10:50:04] <d-snp> thanks for the tips, I'll muck about a bit
[11:09:56] <tommy_the_dragon> I just downloaded the mongodb java driver (v2.9.3) and the class MongoClient cannot be resolved. Should I just be using Mongo?
[11:11:22] <kali> you should use 2.12.x :)
[11:11:28] <kali> and MongoClient.
[11:13:10] <tommy_the_dragon> okay, thanks
[11:20:16] <tommy_the_dragon> I missed it because 2.10 is listed before 2.2 and I haven't had enough coffee :p
[12:15:24] <reese> hi, how can I check how many space has my data on each shard and how many space is free on each shard?
[12:20:59] <Mmike> Hello! I have a 5-member replica set. I kill 3 of my members, and the remaining are SECONDARIES - is this by design, or I did something wrong?
[12:30:38] <joannac> Mmike: by design. you no longer have majority
[12:31:09] <joannac> reese: combination of db.stats (), df, and du ?
[12:32:06] <Mmike> joannac: yup, need to have 3 nodes. What's with 7-member replicaset, is there 5 a majoriti, or also 3?
[12:32:09] <Mmike> majority
[12:33:04] <reese> ok joannac i found article about mongo storage structure i'm reading it now
[12:33:06] <reese> thx
[12:33:10] <Mmike> i'm trying to find explanation of that in the docs, but I'm failing
[12:33:27] <joannac> Mmike: um, I don't want this to turn into a maths lesson, but what's a majority of 7?
[12:34:02] <Mmike> joannac: :P :)
[12:35:05] <Mmike> so, with 7 members I can still loose only 2 of them
[12:35:19] <Mmike> after that - buh-buh cluster
[12:35:25] <joannac> um, what?
[12:36:17] <joannac> Mmike: no, seriously, what do you think a majority of 7 is?
[12:37:39] <Mmike> 4?
[12:37:45] <Mmike> oh
[12:37:45] <joannac> correct
[12:37:54] <Mmike> goes on hiding
[12:38:02] <Mmike> and covering himself into tar and feathers
[12:46:05] <reese> joannac, so question is how can i increase disk space on my shard? when I add new shard free space on another shards is not increse. Why?
[12:47:58] <joannac> is the balancer on?
[12:48:06] <joannac> wait
[12:48:58] <joannac> go read this http://docs.mongodb.org/manual/faq/storage/#why-are-the-files-in-my-data-directory-larger-than-the-data-in-my-database
[12:50:17] <n00b1234> mongo::client::initialize() <-- segfault in the legacy branch of the driver, what can i do?
[12:50:46] <reese> joannac, yes balancer is on
[13:01:51] <reese> so joannac what does mean maxSize parameter when I add shard? I have situation where filesize on shard is around 80GB but i set maxSize on shard as 65000MB?
[13:10:47] <joannac> reese: http://docs.mongodb.org/manual/tutorial/configure-sharded-cluster-balancer/#change-the-maximum-storage-size-for-a-given-shard
[13:11:04] <joannac> "If mapped size [1] is above a shard’s maxSize, the balancer will not move chunks to the shard. Also, the balancer will not move chunks off an overloaded shard. This must happen manually. The maxSize value only affects the balancer’s selection of destination shards."
[13:13:22] <reese> so if filesize is higher then maxsize this shard not take more data yes?
[13:13:58] <joannac> will not take more chunks
[13:14:17] <joannac> also, not filesie, mapped size
[13:19:11] <reese> joannac, for this situation http://pastie.org/9822064 removing of shard4 is safe?
[13:28:01] <joannac> um, no?
[13:28:07] <joannac> define "remove"
[13:28:36] <joannac> if you follow this http://docs.mongodb.org/manual/tutorial/remove-shards-from-cluster/
[13:30:06] <joannac> and have enough space on your other shards for 55gb of data
[13:30:49] <joannac> for an extra 55gb of data
[13:30:58] <joannac> then i guess it's okay
[13:31:04] <joannac> anyway, i'm out
[13:31:15] <reese> joannac, for example on shard1 it should be enough space
[13:31:31] <reese> and i mean remove shard from cluster
[13:31:35] <reese> ths for help
[13:59:42] <Tommeh_> hey all, is there a way to tell mongos to select a non-primary merge shard?
[14:00:29] <Tommeh_> Looks like the default behaviour is to select the primary: https://github.com/mongodb/mongo/blob/v2.6.3/src/mongo/s/commands_public.cpp#L2240
[14:00:44] <Tommeh_> Is there a good reason for that?
[14:01:22] <Tommeh_> Could it be round robin? My primary is melting and the other shards are chilling out :)
[14:57:48] <RaceCondition> is dot-notation in queries supposed to work only up to 2 nesting levels?
[14:58:17] <RaceCondition> i.e. just {"foo.bar": "hello"} and not {"foo.bar.baz": "hello"}?
[15:00:42] <cheeser> that should work
[15:03:12] <RaceCondition> cheeser: but it's not... and I'm really confused as to why
[15:05:24] <RaceCondition> this is what I'm seeing: http://pastebin.com/sdZWNFd8
[15:06:00] <RaceCondition> there's a doc in the DB with data.first_name = "Test" and data.location.street = "Foo"... I can successfully query on data.first_name but data.location.street returns an empty result set
[15:06:20] <RaceCondition> is that expected behavior?
[15:10:27] <RaceCondition> ah, this is embarrasing: I've been typing street instead of street1!
[16:28:17] <DavideD> Hi all, I'm using the MongoDB jdbc Driver and I'm trying to create a user but the command always fails with "no such method"
[16:29:06] <DavideD> I'm using db.command("{createUser: 'davide', pwd: 'asdfa', ... }" is that correct?
[16:29:29] <DavideD> It is the driver fo ra Java application
[16:30:17] <DavideD> if I use db.addUser(...) everything works fine but this method is now deprecated
[16:30:44] <DavideD> sorribas, what am I doing wrong?
[16:46:58] <valenciae> Hello everybody. We've been having issues with our mongo replica. Our web servers complain of not being able to find the master and the site just fails.
[16:47:12] <valenciae> We have not done any changes or updates.
[17:22:49] <superbeef> Maybe somebody can help me digest this from the mongo manual : • http://docs.mongodb.org/manual/reference/method/db.repairDatabase/#db.repairDatabase obtains a global write lock and will block other operations until it finishes.
[17:23:07] <superbeef> does that make ALL databases are locked when running repairdatabase on one database, or just that database is locked
[17:26:20] <kali> superbeef: i think just the one, because locks used to be global but are now database per database
[17:26:37] <kali> superbeef: but i have not tried it
[17:28:15] <superbeef> kali: thanks… sounds like it still may be questionable on these mongo 2.2 boxes i'm stuck with
[17:29:14] <kali> ha ! in 2.2 there is no question. it will lock everything
[17:29:22] <kali> superbeef: ^
[17:29:31] <superbeef> lol great
[17:29:40] <superbeef> thanks
[18:00:26] <Hasan> Hello
[18:11:44] <Hasan> A question. what does a collection mean? For example: is that a user is a collection? and anything related to that user will be stored inside that collection?
[18:13:11] <kali> a collection is analogous to a table in relational databases
[18:14:58] <Hasan> Ok, i was recently reading some articles on Mongo, and i am confused in some areas ,, is that we cant fetch data from two collection at a time?
[18:53:27] <cipher_|> What is the difference between mongod and mongos (I know this is used for the router)?
[18:54:00] <kali> mongod actually store data
[18:54:11] <cipher_|> kali, ah, thanks.
[18:54:20] <kali> mongos only shuffles queries around to the right mongod(s)
[18:54:34] <cipher_|> okay, makes sense.
[21:10:43] <waqasxo> yo
[21:13:49] <joannac> hi
[21:40:57] <waqasxo> does anybody know of a good php framework designed esp for mongo?
[21:41:53] <netameta> how do i delete mongoose schema ? or modle, i had a certain schema, i create an entry, and then change the scema a bit, now when i create other entries to the new scema i get duplicate entry error for the (null) of the missing field - is there a way to delete or some how reset the schema ?
[21:49:45] <joeyjones> netameta: It sounds like you have a unique index on that field. Try using Robomongo to access the collection and check the indexes.
[21:50:19] <netameta> joeyjones yea i do hae unique index on that field
[21:50:46] <netameta> but i dont need that field anymore thats why i want to reset that schema somehow
[21:51:02] <joeyjones> just delete the index
[21:51:49] <netameta> You mean to set the field no unique ?
[21:52:32] <joeyjones> yes
[21:55:07] <netameta> did not work
[21:57:33] <joeyjones> exactly what did you do?
[22:00:16] <netameta> I went to my schema file, readded the field that is problematic, and set the unique / required to false
[22:00:34] <netameta> and then tried to add another entry
[22:05:53] <joeyjones> netameta: What file did you edit? Was it a mongoose file?
[22:06:45] <netameta> joeyjones, i have a js file that defines the schema with all the fields etc..
[22:06:50] <netameta> i edited that file
[22:08:52] <joeyjones> netameta: That's likely a file for the initial creation of the collection at first use so if the collection already exists it likely won't be changed. Use Robomongo (http://robomongo.org/), connect to your db, and check the indexes for your collection.
[22:09:43] <netameta> joeyjones yea i will do that i guess
[22:11:06] <joeyjones> It's also good to have a client on hand for the database anyway, that way you can verify things at the low level
[22:14:31] <netameta> Joeyjones, Ah wow this client is really awesome
[22:14:35] <netameta> i like it
[22:15:53] <joeyjones> If you look in the indexes for the collection you can either delete the unique index or remove the unique flag from it
[22:18:29] <joeyjones> I'm glad you like it. The first thing I do when using a new technology is try to find an IDE for it, that way the adoption process isn't as painful.
[22:18:31] <netameta> Yea found it and fixed it
[22:18:58] <netameta> I removed the index
[22:19:03] <netameta> works perfectly
[22:19:28] <joeyjones> enjoy
[22:20:00] <netameta> Thanks mr.jones
[22:20:16] <joeyjones> No Problem.
[22:20:34] <joeyjones> Man, that would make a good t-shirt "No Problem."
[22:22:40] <netameta> Should remake forest gump and use it a slugen ^^
[22:24:51] <joeyjones> heh
[22:28:02] <joeyjones> http://techcrunch.com/2015/01/09/mongodb-funding-filing/
[22:53:12] <MacWinner> hi, if I want to make a certain attribute in all documents in my collection lowercase, what's the easiest/fastest method? i have an example that does a forEach on the collection, and then saves each individual documnet.. is there some faster way with a bulk update type of thing?
[23:02:43] <lexi2_> is there a perfomance loss of using smallerfiles with mongodb, and is there a way to set that manually or do i need to recomplie the db
[23:08:30] <anybroad> hi
[23:09:42] <anybroad> For a collection of e.g. categories, should I use singular or plural name? 'category' vs 'categories' for a collection of categories (which is referenced to in other documents in the same database)?
[23:11:58] <anybroad> anyone? :D
[23:13:08] <BigOrangeSU> hi can anyone recommend a method for creating a mongo shell script to rebuild a database? I am going to create a script that can be run and will create the users etc.
[23:16:18] <anybroad> schema stuff? mongoose?
[23:20:25] <lexi2_> does anyone know about the noprealloc
[23:26:24] <anybroad> I got a question: What primitives does mongodb support? Like in mysql, datetime, date?
[23:26:40] <anybroad> is there a list of supported / available primitives and how to use them for maximum performance?