[00:30:32] <BadHorsie> I have a collections ipNets with entries like: {"cidrs":{"10_0_0_1/24":{"ip":{"10_0_0_2":{name:"mygw"}}}}}, I'm curious about how to search for {"name":"mygw"}, I usually do like "cidrs.<range>.ip.<ip>.name", but in this case I don't know the <range> or <ip> from the query...
[02:24:04] <OnePrettyCoolGuy> I'm trying to use a variable as an object key, and instead of getting the value of that variable its just setting it to that name.
[02:24:46] <OnePrettyCoolGuy> I'm not sure, I'm trying to update an array of mine.
[02:49:41] <OnePrettyCoolGuy> Think you can help me with my issue?
[02:50:07] <OnePrettyCoolGuy> I'm literally 2 seconds away from smashing my head onto my keyboard.
[03:49:28] <OnePrettyCoolGuy> I'm trying to use a variable as an object key, and instead of getting the value of that variable its just setting it to that name.
[03:49:55] <OnePrettyCoolGuy> I'm not sure, I'm trying to update an array of mine.
[04:29:43] <OnePrettyCoolGuy> My issue here is that I have the name of the array I want to push new items to, but when I use name: 'hello' it actually uses 'name' as an object key, not the value of var name.
[04:30:30] <joannac> so your array is called something different depending on the exact object?
[04:32:12] <joannac> you have one document with data from different users?
[04:32:22] <OnePrettyCoolGuy> Before this function, another is ran where it initializes that array, and then this function is called once the user inputs some text (this function is where their unique array is populated)
[04:34:30] <OnePrettyCoolGuy> I've been stuck on this thing for the past 3 hours I believe.
[04:35:51] <OnePrettyCoolGuy> @joannac: Any idea how to do this? I've literally asked everywhere, Stack Overflow, other IRC channels.
[04:36:26] <joannac> OnePrettyCoolGuy: okay, let me get this straight
[08:18:03] <Dakutta> Hey everyone. Been a while since I used irc ... anyway! I hope that you can give me a little advice on something.
[08:21:12] <Dakutta> We inherited a mongodb shard here when a coleague left and I got the task to apply the newest linux patches to the machines. Is there maybe a writeup somewhere on what I have to ... well ... do to make sure I don't break the shards/config-servers in the process? ( ;
[08:23:24] <mattsah> is it possible to find with criteria found on another collection via a db ref?
[08:35:07] <KekSi> hi - i have a question concerning the $external db (to use with X509 certificate login) - why it it not partitioned and located on a replica-set rather than the config db? { "_id" : "$external", "partitioned" : false, "primary" : "rs0" }
[08:36:02] <KekSi> i'd expect it to be on the config servers like the admin db
[12:21:12] <m3t4lukas> as I understood $not $eq would also deliver those documents that don't have that field I test the condition on while $ne only delivers those documents that do have the field AND do not match the value
[12:21:34] <m3t4lukas> but you can't use $not and $eq together
[12:22:00] <m3t4lukas> you also can't use $not with a regular expression
[12:22:46] <deathanchor> http://docs.mongodb.org/manual/reference/operator/query/ne/#op._S_ne says: This includes documents that do not contain the field.
[12:24:10] <m3t4lukas> I use C driver 1.1.5 in D with a >3 database
[12:26:32] <m3t4lukas> deathanchor: I do an Interface, that you only communicate with an abstract model layer. The model then gets translated to whatever database you give it. It can be SQL, it can be google nosql, it can be mongo, it can be that doc storage from openstack etc
[12:26:40] <deathanchor> HA! I have run into issues with drivers, for instance I'm using some old java driver and it won't obey the "use secondary" for counts/distinct searches
[12:27:18] <m3t4lukas> deathanchor: I always test in robomongo and in console
[12:27:29] <deathanchor> I would test it in mongo shell, then if it works there but not via driver, then there is obviously something funky with the driver
[12:28:24] <m3t4lukas> and a month ago 1.1.5 driver was the latest and greatest, but it is always two weeks of work to port the C includes into D imports
[12:28:46] <m3t4lukas> As soon as I got time I will do a native D driver
[13:12:23] <StephenLynx> they look at the costs of porting it to linux.
[13:12:26] <StephenLynx> and it just doesn't pay off.
[13:13:07] <StephenLynx> but as any other profit-driven decision, you cannot justify the whole world based on that.
[13:13:21] <m3t4lukas> yeah, well, I know many companies who only have windows machines where they have to use Autodesk products
[13:14:28] <StephenLynx> first, anecdotal evidence. second, I don't get your point on that.
[13:17:22] <jecran> Good morning guys. I am trying to do a query, however my result is always printing my id instead of the field I am looking for. https://gist.github.com/anonymous/8dacaea7dfee4e05ea35 can someone please let me know what I am doing wrong?
[13:17:59] <StephenLynx> you are using the query in the projection block and vice-versa.
[13:18:40] <jecran> StephenLynx: im still new to this, lamens terms?
[16:25:16] <shlant> morning all. Anyone know why the 'boss' user is trying to authenticate against the 'admin' db with this url? 'mongodb://boss:pass@mongo-1.node.consul,boss:pass@mongo-2.node.consul,boss:pass@mongo-3.node.consul/inventory?readPreference=secondaryPreferred&replicaSet=rp0'
[16:25:36] <shlant> shouldn't /inventory mean it get auth'd against the 'inventory' db?
[16:25:59] <shlant> and yet the logs show 'I ACCESS [conn12401] SCRAM-SHA-1 authentication failed for boss on admin from client 172.17.0.14 ; UserNotFound Could not find user boss@admin'
[16:27:15] <shlant> do I need to specify http://docs.mongodb.org/manual/reference/connection-string/#uri.authSource for some reason?
[17:42:02] <kopasetik> MONGO DB QUESTION: i want to nuke (aka delete) my mongodb database because it says that i have circular references. i would just drop it right?
[18:11:48] <sbhawsin> Hey all, I have a question. I am using mongodb v2.4.13 and I want to get the number of documents which got updated in a particular update call. I am doing this in python
[18:12:01] <sbhawsin> Please see this: http://fpaste.org/232278/34391695/
[18:12:37] <_ari> sbhawsin: why don't you put a timestamp?
[18:14:03] <sbhawsin> _ari: I am not sure but by putting timestamp, how can I get the exact number of updated documents.
[18:14:38] <StephenLynx> the update function should give you that information back.
[18:14:53] <StephenLynx> in the node driver, the callback returns the error and query information.
[18:15:05] <StephenLynx> containing how many were matched and how of them were updated.
[18:15:26] <StephenLynx> you should consult your driver's documentation for that information.
[18:15:59] <sbhawsin> Can you please check the code? http://fpaste.org/232278/34391695/ . Here the result is giving correct information but the update is not executing. I am not getting an updated timestamp
[18:38:50] <carlgotting> how does mongo handle multiple connections to the same document?
[18:39:09] <carlgotting> im coming from sqlite3 on a project, and im running into limitations with it
[18:39:33] <carlgotting> i need something fast and that can handle concurrent reads and writes
[18:40:23] <mrmccrac> individual reads/writes to docs are atomic
[18:40:36] <mrmccrac> in 3.0 i believe it has document-level locks
[18:41:16] <mrmccrac> if you have to do multiple reads/writes on the same doc and want all your operations to be atomic you're boned and have to roll out your own locking/transaction solution externally
[19:33:13] <gabrielsch> I have this following schema : https://gist.github.com/gabrielsch/d8ee8b11fa9002ecfac9 and I want to find "supplies" by "sku", can I do that? or my schema is too bad? :(
[19:52:48] <StephenLynx> I have a personal dislike for any ODM, tbh.
[19:53:12] <StephenLynx> that way you can just look for a particular child.
[19:53:20] <GothAlice> That's unfortunate. ODMs automate repetitive tasks on your data, since any task worth doing right is worth doing twice, and any task worth doing twice is worth writing a tool to do it for you…
[19:53:26] <StephenLynx> or any parent's children.
[19:53:39] <StephenLynx> so I can abstract that particular task on my code.
[19:53:47] <StephenLynx> without losses like mongoose's of 600%
[19:53:58] <GothAlice> Well, certainly there will always be bad examples.
[19:54:13] <StephenLynx> the problem with tools that abstract EVERYTHING is that it will perform these abstractions all the times.
[19:54:22] <StephenLynx> it is an absolute that you cannot controls.
[19:54:36] <StephenLynx> when you don't use them, you abstract said repetitive tasks as much as needed.
[19:54:40] <GothAlice> Most ODMs pale in comparison to Python's MongoEngine, as an example, and MongoEngine lets you very easily drop down to pymongo, then back up to MongoEngine rich document objects as needed.
[19:54:55] <GothAlice> So your overly broad statements about ODMs in general are false. ;P
[19:56:04] <GothAlice> StephenLynx: For example: https://github.com/bravecollective/forums/blob/develop/brave/forums/component/thread/model.py#L120-L133 — this runs a custom query (since MongoEngine's support for $ is weak at the moment) then wraps the result in an embedded document class from MongoEngine.
[19:56:28] <jacksnipe> Is there any support for sets or some other sort of unsorted list within a document?
[19:56:37] <jacksnipe> question about mongo in general, not mongoengine :P
[19:56:47] <GothAlice> jacksnipe: Indeed. $addToSet is what you need for that. MongoDB will then handle uniqueness checking server-side.
[19:57:04] <GothAlice> Only adding to a list intended to be used this way is impacted by this use.
[19:57:07] <StephenLynx> look for the array operators documentation.
[19:57:34] <StephenLynx> there are many useful operators for arrays in almost any function.
[19:57:56] <GothAlice> Only one needed to treat it as a set, though. ;P
[19:58:02] <gabrielsch> Can't I use $elementMatch to find my supplies by SKU? like that: http://stackoverflow.com/questions/10043965/how-to-get-a-specific-embedded-document-inside-a-mongodb-collection
[19:58:19] <gabrielsch> I've tried db.Supplier.find({'supplies.sku': { "$elemMatch" : {'sku': 'DDD123'}}}).pretty(); but no success :(
[20:01:46] <GothAlice> Yeah, my initial gut instinct when looking at that is to douse my monitor with lighter fluid and ignite. The lack of indexes is going to really, really hurt. And no, you can't use $elemMatch on that.
[20:02:25] <gabrielsch> GothAlice: I think I'll migrate it to an external collection
[20:02:37] <gabrielsch> and use ObjectId on supplier to reference them
[20:02:46] <gabrielsch> GothAlice: that would be better?
[20:02:50] <GothAlice> Let me fork your gist to demonstrate the "right way" to do exactly this. Nesting them is quite possible, and even quite effective.
[20:04:48] <GothAlice> That documentation page references a static asset (JS, CSS, image) that isn't loading for me, preventing the entire page from loading. \o/
[20:09:22] <gabrielsch> and referenceMany will create other collection, and references using ObjectId
[20:09:26] <GothAlice> By virtue of this being PHP, it's bad and should feel bad by encouraging you to do something _terrible_.
[20:09:46] <GothAlice> PHP treats associative arrays (mappings, dictionaries, hash tables) and arrays (lists, sets) as the same thing.
[20:10:14] <GothAlice> The documentation here is omitting a usage example which would need to clearly indicate you are _not_ supposed to use it as an associative mapping.
[20:10:38] <GothAlice> While Mongoose will be first against the wall when the revolution comes, Doctrine will be a close second.
[20:12:52] <gabrielsch> btw it was a bad decision to use that and didn't come from me
[20:13:03] <gabrielsch> but now I have no choice, we'll migrate in the future, but we can't now
[20:20:11] <GothAlice> gabrielsch: Well, it's the combination of PHP's laissez-faire data types and poor Doctrine documentation that got you where you are. https://gist.github.com/amcgregor/0afd451d23e068d0eb7d#file-migration-js is the fix for your data, BTW, or something very similar.
[20:20:39] <GothAlice> (Runnable from the MongoDB shell.)
[20:22:21] <GothAlice> This is also safe, though will require extra storage space. (I.e. running it the first time makes a copy of the data. You'd then need to drop the old field and rename the new one in place. Or you could change that update to set the value using the real and add some "is it actually an array, or an object" checking at the top if you have backups elsewhere.)
[20:22:45] <GothAlice> s/using the real/using the real field name/
[22:41:50] <fllr> I'm trying to setup a replica set with mongo using Salt. Everything goes well until I have to actually add the machines onto the set (rs.add()), and initiate the set (rs.initiate()). Is there anyway Mongo can add the machines onto the replica set according to a text file of some sort, or at least the command line, instead of requiring me to go into the mongo shell, and typing commands there?
[23:05:34] <fllr> joannac: Yeah, I guess that'll work. Ideally, though, mongo could just read a file that listed out the machines, and do everything based on that...
[23:06:52] <StephenLynx> can you pipe a file to mongo with said arguments?
[23:07:20] <StephenLynx> like cat settings | mongo?
[23:08:52] <cornfeedhobo> hello. i would just like to confirm something regarding replication. i am confused about the relationship between needing "an odd number of voting members" vs "need at least 3". which is it? because i have tested a few scenarios, and it would seem as if as long as i have 3 or more, voting works out properly ...
[23:22:17] <devSeb> Hey folks! Have a rookie question for MongoDB. Been trying different stuff, but no win. How do I easily get the number of items of an array inside a document?
[23:23:44] <StephenLynx> i think you will have to get the document and use your language way to see how long it is.
[23:23:56] <StephenLynx> couldn't find anything on the array projection operators
[23:32:09] <joannac> cornfeedhobo: odd number of votes, and > 3
[23:36:14] <cornfeedhobo> joannac: well, i tested with 5 members. 4 servers, 1 arbiter. killing the primary didn't result in a conflict, but there were 4 voting members left ....