[03:08:30] <calvinx> I am trying to return only specified fields but I don’t seem to be getting the expected results. (reference http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-only )
[03:08:44] <calvinx> This is what I have done in my shell http://dpaste.com/1TEXXND
[03:09:22] <calvinx> I am expecting `db.roles.find({_id:1})` to rertun me the same results as above minus the “name”: “developer” key-value pair.
[04:00:52] <joannac> okay, i think i missed the first part of this question
[04:01:09] <calvinx> : I am trying to return only specified fields but I don’t seem to be getting the expected results. (reference http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-only )
[04:01:14] <sachinaddy> Hi.. all .. i m need some small help.
[04:01:16] <joannac> but db.roles.find({}, {_id:1})
[04:01:22] <joannac> will definitely return all documents
[04:01:27] <sachinaddy> i m unable to connect to localhost of mongodb
[04:01:34] <calvinx> AH. that’s what I want to achieve. cool.
[04:02:31] <joannac> sachinaddy: um, okay. but the mongod is there?
[04:03:35] <sachinaddy> warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it.
[04:28:05] <LouisT> so, what do you guys think the best web panel for mongodb management is?
[04:37:58] <cortexman> would it be smart to create huge numbers of collections to avoid having to have collections that point to collections that point to collections etc.
[04:43:29] <joannac> why would having large numbers of collections help?
[04:44:48] <sachinaddy> I m successfully able to import a csv into a collection. Is there a way to autoload the csv ? I mean, if I put a file in some location, mongodb acutomatically import it?
[04:45:37] <cortexman> joannac, suppose you have As, which contain links to Bs, which contain links to Cs, which contain links to Ds. suppose there are many of A, B, C and D. if there are only four collections, then it seems like you're just doing random access on disk.
[04:46:18] <cortexman> suppose instead that for each A you multiplex the number of collections so that you have A_id, B_id, C_id, D_id. the latter scheme could be faster because mongo knows where all those collections live on disk.
[04:46:19] <joannac> cortexman: um, okay. so how would lots of collections fix that?
[04:46:43] <joannac> so you'd store one document per collection?
[04:49:31] <stefandxm> ive been about doing research of # collections that is not a performance loss compared to # documents in a collecion with semi decent indexes
[04:49:55] <cortexman> i get 2047 megabytes (max namespace size) / 123 bytes (size per namespace) = 17,450,691
[04:50:15] <joannac> The limitation on the number of namespaces is the size of the namespace file divided by 628.
[04:50:23] <joannac> A 16 megabyte namespace file can support approximately 24,000 namespaces. Each collection and index is a namespace.
[04:50:42] <cortexman> ok that's about 3.5 million namespaces
[04:50:53] <sachinaddy> joannac, would it be good if I use mongodb for dashboarding along with node.js? The data in mongodb would be huge.
[04:51:31] <cortexman> stefandxm do you get good lookup performance with many collections? i.e., is it fast to find a collection by name?
[04:51:59] <stefandxm> so far its decent, but ivent put it under stress yet so cant tell
[04:52:13] <cortexman> my real question is, what's the normal way to handle the situation i'm in
[04:52:26] <stefandxm> my main concern is probably lockings of the namespace (collection?)
[04:52:42] <cortexman> collection A contains a bunch of links to random documents in collection B, B contains links to random Cs, Cs contain random links to random Ds, etc.
[04:52:48] <cortexman> that sounds like lots of thrashing on disk.
[04:53:15] <joannac> Not unless it won't fit in RAM
[04:53:46] <stefandxm> cortexman, i have approx the same issue
[04:54:26] <stefandxm> our data layer is kindof like a file system and the "files" often have random links to other "files"
[04:54:54] <stefandxm> currently each folder has a collection
[04:54:58] <cortexman> is that why you are experimenting with lots of collections?
[05:20:06] <joannac> also, I hope this is a test instance
[05:24:28] <garmet> joannac, so you always have to split? It is for testing, is it that bad?
[05:26:00] <joannac> yes, you do need to split it. those tag ranges both cover the same chunk right now
[05:26:20] <LouisT> what.. can i not remove a group on MMS? it says i have to remove all users and hosts, to do so but i can't remove myself from the group?
[05:27:08] <joannac> and yes, unless you're generating random _ids, your shard key is monotonically increasing
[05:27:15] <joannac> which means no write distribution
[05:27:31] <joannac> LouisT: open a MMSSUPPORT ticket and someone will help you remove it
[05:28:38] <garmet> ok, I'll look that up. Although I have managed to put documents on the correct shard, it's just that the ranges didnt exactly match my interpretation of min-max range.
[05:28:43] <joannac> LouisT: offhand, where does it say that? I thought we fixed all our docs, let me know if we missed one and I'll fix it up
[05:29:25] <garmet> joannac, I dont per say want an even write distribution. Just a segmentation of data between physical machines.
[05:31:07] <garmet> joannac, would it be better that I create multiple collections instead? one for each machine and apply the full _id range as tagRanges?
[05:31:35] <joannac> garmet: I'm not sure I understand what you mean
[05:33:19] <garmet> Well what I want to do is to partition data to a specific machine depending on a certain property. Not read/write balancing.
[05:33:50] <noose> great if i can get help on mongo-connector
[05:38:28] <LouisT> hm, i assume i can't use my mms account with jira..?
[05:39:01] <garmet> joannac, but I guess split/pre-splitting is the answer? Could one option be to reduce chunk sizes? If so, how can I know what is appropriate?
[10:34:38] <rasputnik> just ran movePrimary to shift a fairly small (20Gb odd) db from one shard to another (it's unsharded data)
[10:34:52] <rasputnik> now both secondaries in the replica set are RECOVERING
[10:35:21] <rasputnik> and getting lots of 'replset not trying to sync .... it is vetoed' type errors
[10:36:54] <rasputnik> also says it's too far behind to catch up, which is a bit odd because the oplog goes back 50-odd hours and it only happened about 45 minutes ago
[11:04:43] <pgustafs> Nomikos, thanks, but i only wants the docs where both fields are identical, that query finds the document where one or two fields is identical
[11:25:36] <nalum> I'm trying to set up mongodb ssl and am having trouble. When I start it with /opt/mongodb/bin/mongod --config /etc/mongod.conf I get a warning about missing the sslCAFile parameter and then it exits. Is this required? I didn't think it was when using a self signed cert.
[11:40:40] <nalum> Figured it out it was permissions on the pem file, though now when I run it as service mongodb start it's not starting (wasn't before either) and it's not throwing any errors that I can see. I'm tailing the log file but that's not showing any activity. Would it log anywhere else?
[11:53:04] <nalum> Okay, figured that out, it didn't have access to the mongod command. Now I'm getting an error about permissions on the pem file again, I think they are correct the pem file is owned by the mongodb user and group and the user has read write access to it, group and other have no access to it. I'm getting Permission Denied, which is leading me to believe that the user is not correct.
[12:03:23] <nalum> Got it sorted the folder /etc/ssl/private only allows root access once the pem and key files were moved out of there it all worked.
[12:46:05] <ArSn> Is there a way to use index hinting for multikey indexes?
[13:35:53] <cheeser> new mongo-hadoop hot out of the oven: https://github.com/mongodb/mongo-hadoop/releases/tag/r1.3.0
[13:49:42] <ernetas> We recently reseted one of our MongoDB servers. It now does not get to PRIMARY status, although rs.status() on other nodes show it as primary.
[13:50:05] <ernetas> http://pastebin.com/raw.php?i=EYBqaHZL - this is what we get. What could be the issue?
[14:00:27] <q85> ernetas: you restarted the server?
[14:25:17] <ernetas> I wouldn't mind recovering it as a standalone either...
[14:26:36] <q85> have you tried reconfiguring it with rs.reconfig()?
[14:27:06] <kali> ernetas: standalone should be easy: start it without the rs option. I advise you kill the other server or set a different port to avoid creating more chaos
[14:28:59] <ernetas> kali: I then get "WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset"
[14:29:45] <kali> ernetas: yeah, that warning makes sense :)
[14:29:57] <kali> except for the plural form, maybe :)
[14:30:15] <kreantos> hi, is this the right channel also for morphia related questions?
[14:32:02] <kreantos> cool, so i have a java-object, but I'm not mapping all the elements of a document to it. do i have to map all the elements in order to use the datastore.save method?
[14:33:09] <cheeser> no, by default morphia will use the java field name for the document property name.
[14:34:07] <kreantos> no, i mean i have not all properties of a documents as java fields
[14:34:47] <cheeser> oh, there's more in the db than in your java class.
[14:34:50] <kreantos> as i am using an already existing collection which has a lot of overhead i don't need right now
[14:36:00] <cheeser> currently, i think you'll need to map them all. morphia will overwrite the document on save(), iirc
[14:36:45] <kreantos> oh :-(, this is what i feared
[14:37:05] <KushS> I am using mongoose for my node app. Earlier I used it to connect to a mongolab db but now I am using the same code to store data on my local db but the it does'nt seem to register the schema I created. Should I change something else apart from the db url ?
[14:39:54] <kreantos> cheeser: thanks for the info
[14:43:43] <cheeser> you might write a simple test to confirm, though.
[14:43:48] <ernetas> kali: ghm, seems like I'm back... The first time I tried to launch it as a single node, I couldn't even "show collections" in local database, was stalled completely. Thanks (for motivation to try it again :D )!
[14:44:13] <cheeser> i'll take a look. i know we do something different if the id field is already populated. maybe we already issue an update with $sets in that case.
[14:44:19] <cheeser> if not, that's what we *should* be doing. ;)
[14:46:22] <cheeser> that logic mostly exists but only for versioned entities.
[14:47:22] <kali> ernetas: that's not good. it might be the right time to check that your disk and file system are not misbehaving
[15:08:41] <Chaos_Zero> I have a single mongo instance running on a web server. I would not open the port at all execpt the manager would like to admin outside of ssh with a gui tool. I just need one admin user to connect to this database. How do I create this user?
[15:17:55] <cozby> in a replica set, if the primary gets overloaded with traffic/requests and becomes unavailable an election will occur and a new master will be elected, but what if that traffic blast doesn't stop
[15:18:16] <cozby> wouldn't that cause a vicious cycle of elections
[15:19:40] <cozby> my main concern is having single point of failure - the master. Yes replica sets fail over but then that single point gets shuffled and the same thing can occur to the next instance
[15:19:57] <cozby> cheeser: then how do people scale mongo?
[15:21:08] <cozby> does sharding alleviate the example I provided? Isn't sharding more of a solution to scaling data not really requests?
[15:30:10] <nalum> Hey, I've setup mongodb with ssl and it seems to be working fine except that it doesn't start with system boot. Any one got pointers on what the issue could be?
[15:37:42] <cozby> nalum what flavour of linux are you running?
[15:39:04] <nalum> ubuntu 14.04, I have copied https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart to /etc/init/mongodb.conf
[16:03:43] <sellout> Yeah, figured I was expecting a bit much, there ;)
[17:33:15] <juergen_thomann> Hi, Does anyone of you have some links for where I can look how mongodb does shuffle and sort as it is called at hadoop? I haven't found anything in that direction so far.
[17:42:32] <tscanausa> juergen_thomann: are in map reduce?
[17:44:20] <juergen_thomann> tscanausa: yes. I try to understand how mongodb handles for example to big results which do not find memory during map
[17:45:13] <tscanausa> it uses temporary collections
[17:48:10] <tscanausa> I lied it uses temporary files if you allow it to
[17:50:49] <juergen_thomann> tscanausa: If I now have a sharded mongodb database, does this still work? at the end the same keys have to be reduced somewhere. With collection I could imagine it with a sharded collection but on disk temporary files have to be transmitted in another way.
[17:51:28] <tscanausa> so each shard will do its own work then the work will be merged together at the end
[17:53:50] <sigurding> guys, is there any option to have db.collection.insert({ with “$binary”…}); like for example with ObjectId?
[17:57:07] <juergen_thomann> tscanausa: one last question: Does this last merging happen at a mongos or on one shard when the results are written to a new collection
[17:58:02] <tscanausa> sigurding: I do not understand your question
[17:58:28] <sigurding> tscanausa: will give you an example just a moment
[18:00:29] <sigurding> tscanausa: solved it….I had db.collection.insert({ … data" : { "$binary" : ….}});, which threw an exception. Had to replace it through: BinData()
[18:11:23] <Tug> Do you guys know a simple way to sync my production database locally? I was using db.cloneDatabase('REMOTE_SERVER'); but it usually fails now that my db is a bit large
[18:17:55] <tscanausa> Tug: you could read the oplog and send it your local instance. it how i keep my staging environment up to date with 10% of the production data.
[18:19:22] <Tug> tscanausa, so you're suggesting having a script on the prod server which connects to your local computer and watches for changes
[18:20:02] <tscanausa> just a suggestion. but I generally do non standard things
[18:22:38] <Tug> tscanausa, yeah it's not bad. Problem is sync is a punctual task for me. I usually copy it for debug only and my computer is not always online
[18:23:31] <Tug> problem with mongodump is the amount of data it duplicates + the extra time induced
[18:23:54] <Tug> in fact I don't have the space for twice my prod db on my local HDD
[18:24:04] <Tug> I should buy a new hard drive though
[18:24:19] <tscanausa> Tug: you could keep a short connect time and if it fails to write it fails to write
[18:26:09] <Tug> tscanausa, ok but then when my computer goes back online it only sync new data right ?
[18:26:38] <tscanausa> depends on how you write your script but in simpliest terms yes
[18:27:53] <Tug> It would be great if I could use mms' backup technology locally
[18:30:27] <Tug> Or have cloneDatabase doing incremental update :)
[19:05:03] <ekristen> if I have a collection.find and I am using a cursor to loop over all the entries, and it was looking for state: 1, if an entry that hasn’t been looped over yet gets updated by another process to state: 2, will the first find still iterate over it?
[19:11:26] <ekristen> so the cursor is real-time essentially
[19:11:42] <ekristen> if it hasn’t reached a document yet and that document gets updated then the next find won’t find it
[19:11:45] <q85> better stated, there are no transactions
[19:12:30] <ekristen> q85: so let me put it to you another way
[19:13:16] <ekristen> if I have 1000 documents with state: 1 and I start a find and start iterating over the documents using a cursor and another script adds another 1000 documents with state: 1 will the first find find the new ones, or will I have to start another find
[19:14:41] <q85> Hmm, I think in that case it depends on where the documents are added and the query pattern. In short, you could find the new documents.
[19:15:08] <stefandxm> you could also get the same document twice or more
[21:03:52] <duckchat> is there some way to tell mongodb a field type during mongoimport csv?? importing as numeric and would like string
[21:04:12] <mchapman> Can anyone help with what seems to be a bug illustrated by this gist: https://gist.github.com/mchapman/078818d5229129c8cce5 ?
[21:05:09] <stefandxm> dukchat, do you really need the mongo import for csv files? csv parsing is like 5 lines of code in any language
[21:05:29] <mchapman> At least enough to say whether they think it is a mongodb, node driver or mongoose bug
[21:05:46] <stefandxm> dukchat, with only 4 Mrows (if you can keep it like that) i would have it loaded into memory and then written with bulk operations after having done the fixing
[21:06:14] <duckchat> stefandxm: well, the mongoimport is blazing fast
[21:07:03] <stefandxm> with the bulk operations in the driver i doubt it would make a difference
[21:08:31] <duckchat> stefandxm: thx. going to look hard at bulk update.
[21:09:00] <stefandxm> just make sure your driver has support for it :)
[21:09:13] <stefandxm> (that might force you to use another language)
[21:17:58] <mchapman> Running the query in mongo shell gives same response in 2.4 and 2.6 (in case anyone is interested)
[21:19:19] <chanced> does anyone know if I can rely on the integrity of order when it comes to embedded docs (received by node)
[21:20:24] <chanced> i need to allow for re-ordering and kind of hesitant to create a separate field on the container
[21:54:52] <richthegeek> so I keep hearing about TokuMX but it's always given me a sort of intangible "Don't touch this dodgy software" smell.... does anyone have opinions on it? Probably a biased place to ask this!
[21:58:51] <q85> richthegeek: I haven't used it myself, but I've also gotten the same vibe.
[21:59:25] <richthegeek> i've seen plenty of write ups that seem to be positive (http://blog.parse.com/2014/06/20/fun-with-tokumx/) but my gut keeps saying "no"
[22:00:51] <dArF1k__> for some reason i'm not able to do find by _id
[22:00:52] <q85> I remember reading something in some of Mongo's jira tickets comments section about people having issues with it. I don't recall any details though.
[22:01:13] <richthegeek> dArF1k__: put your code into pastie.org?
[22:02:33] <dArF1k__> it works if I use any other field in query but not _id
[22:03:07] <richthegeek> verify what the query is: console.log(_id, {_id: new mongodb.ObjectID(_id)})
[22:03:56] <richthegeek> it's generally rare to have to case an ID as an actual ObjectID - either you're not using an auto-generated ID (ie your id is "bob") or the ID is already an object of that type
[22:07:08] <richthegeek> curious, very curious... i'm stumped
[22:07:10] <dArF1k__> i tried with new BSON.ObjectID(id) too and nothing
[22:08:04] <dArF1k__> anything i may be missing in connection options?
[22:09:31] <richthegeek> nothing i can think of! assuming the document exists and the query is correct then there's no reason it shouldn't return something.
[22:09:52] <richthegeek> as you've verified both of them, it's a thorough mystery
[22:10:29] <richthegeek> correct collection? does it work if you do findOne (which you should be doing with an ID query anyway)? try logging the output directly in the return (console.log(arguments))?
[22:11:10] <dArF1k__> I'm using same function to find all documents with account: XXX or _id: id... account: XXX works OK
[22:13:07] <aaronds> (Java API) Hi I'm having some problems trying to use a WriteResult - I'm trying to get the id of the document I just inserted. Sample: http://pastebin.com/4GnPHWqE could anyone point out what I'm doing wrong?
[22:13:36] <dArF1k__> hmm... findOne returned document
[22:13:56] <dArF1k__> does that mean find(_id: ...) does not return cursor but document?