PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 15th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[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:22:54] <OnePrettyCoolGuy> hi
[02:23:17] <OnePrettyCoolGuy> Is any juan there?
[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:25:25] <OnePrettyCoolGuy> Well...ehh.
[02:26:41] <OnePrettyCoolGuy> Alright, never mind.
[02:33:11] <preaction> well, if you know juan, you know jamal
[02:49:16] <OnePrettyCoolGuy> Wait a moment
[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:26:15] <joannac> OnePrettyCoolGuy: huh?
[04:28:24] <joannac> OnePrettyCoolGuy: using a value of a variable as a keyname already sounds a bit dicey. what are you actually trying to do?
[04:28:49] <OnePrettyCoolGuy> #joannac: https://gist.github.com/InternetExplorer7/854b2efec075dbfef945
[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:30:38] <joannac> s/object/document/ ?
[04:30:48] <OnePrettyCoolGuy> Yep
[04:31:14] <joannac> ...why?
[04:31:34] <OnePrettyCoolGuy> For different users
[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
[04:36:42] <OnePrettyCoolGuy> yep, shoot.
[04:36:43] <joannac> your document in the database looks like {x: ["a", "b"]}
[04:36:52] <joannac> but the "x" part can be named whatever
[04:36:57] <OnePrettyCoolGuy> Yes, except with nothing inside
[04:37:05] <joannac> and the actual name is stored in the variable "name"
[04:37:06] <OnePrettyCoolGuy> Yes, usually a name.
[04:37:11] <OnePrettyCoolGuy> yep
[04:38:30] <OnePrettyCoolGuy> An empty array of their name is created everytime a new user registers.
[04:38:43] <joannac> obj = {}; obj[name] = 'hello'
[04:38:54] <joannac> obj then has the right syntax for $push
[04:39:37] <joannac> you are going to hit all kinds of problems with this schema though
[04:39:54] <OnePrettyCoolGuy> That's the solution I've been given countless times
[04:40:13] <OnePrettyCoolGuy> The problem with that is that the new value just replaces what was previously there
[04:40:19] <OnePrettyCoolGuy> So its not building onto the array
[04:40:27] <joannac> ?
[04:40:57] <OnePrettyCoolGuy> I want it to build onto the array everytime the function is called
[04:41:05] <OnePrettyCoolGuy> Not replace what was previous there
[04:42:02] <joannac> OnePrettyCoolGuy: then you're doing it wrong
[04:42:12] <joannac> I just ran 2 updates with that code
[04:42:19] <joannac> and now I have { "_id" : ObjectId("557e571bf2064e4e99a52ad7"), "x" : [ "hello", "hello" ] }
[04:42:26] <joannac> which is what you want, right?
[04:42:30] <OnePrettyCoolGuy> Ok one moment, let me paste somewhere.
[04:42:33] <OnePrettyCoolGuy> Yeah, thats right.
[04:47:16] <OnePrettyCoolGuy> @joannac: This is what my flow looks like right now: https://gist.github.com/InternetExplorer7/4105420adaaee31a5df3
[04:48:18] <OnePrettyCoolGuy> some values are sample until I get the front end set up
[04:49:18] <OnePrettyCoolGuy> The frony-end is where the actual item and id will be coming from.
[04:51:06] <joannac> OnePrettyCoolGuy: dunno, works for me in the shell
[04:51:19] <joannac> what's the output you get?
[04:53:34] <OnePrettyCoolGuy> @joannac: https://gist.github.com/InternetExplorer7/ee6aff2705b9ed17a7c0
[04:54:04] <joannac> OnePrettyCoolGuy: um, and that's wrong why?
[04:54:11] <joannac> that's exactly what I expect you get
[04:54:39] <joannac> what are you expecting to get?
[04:55:36] <OnePrettyCoolGuy> But when I run again, it isn't adding an extra item to that array
[04:55:44] <joannac> run what again?
[04:56:09] <OnePrettyCoolGuy> say re-launch nodeJS
[04:56:14] <OnePrettyCoolGuy> my nodeJS app
[04:56:17] <OnePrettyCoolGuy> oh
[04:57:47] <OnePrettyCoolGuy> oh my
[04:57:48] <OnePrettyCoolGuy> god
[04:57:53] <OnePrettyCoolGuy> I'm so
[04:57:54] <OnePrettyCoolGuy> stupid
[04:58:27] <OnePrettyCoolGuy> I kept relaunching my nodeJS app to see if it would add more items to my array.
[05:00:54] <OnePrettyCoolGuy> Thank you @joannac
[05:02:03] <joannac> np
[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
[11:17:58] <m3t4lukas> aaaargh O-O
[11:18:05] <m3t4lukas> http://docs.mongodb.org/manual/reference/operator/query/not/#op._S_not
[11:19:17] <m3t4lukas> why isn't it {$not: {<field_designation>: { <operator>: <value>}}}?
[11:20:38] <m3t4lukas> why does it have to be {<field_designation>: {$not: {<operator>: <value>}}}?
[11:21:33] <m3t4lukas> that may if I want an abstract interface I have to add a property "negated" for every operation the not can be applied to
[11:21:56] <m3t4lukas> otherwise I would just use an operation class for a negation...
[11:23:22] <m3t4lukas> *way
[11:47:08] <m3t4lukas> Is there a list what can be negated using $not?
[12:15:00] <deathanchor> m3t4lukas: $nin ?
[12:15:44] <m3t4lukas> no a list of those operators http://docs.mongodb.org/manual/reference/operator/query/ you can actually use $not on
[12:17:21] <deathanchor> everything?
[12:17:37] <m3t4lukas> like you can't use $not with $eq although $not $eq and $ne would deliver two different result sets
[12:18:35] <m3t4lukas> no, not everything, that is the issue
[12:19:14] <deathanchor> really?
[12:19:15] <deathanchor> news to me
[12:19:32] <m3t4lukas> tried it
[12:19:51] <deathanchor> let me give it a whirl
[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:31] <deathanchor> uh really about $ne?
[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:23:12] <m3t4lukas> Oh, I see :P
[12:23:26] <deathanchor> m3t4lukas: I think you are doing something funky.
[12:23:36] <m3t4lukas> Oh yes, I do
[12:23:36] <deathanchor> are you using 2.6+?
[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
[12:29:12] <cheeser> that would be awesome.
[12:50:55] <m3t4lukas> @cheeser what would be awesome? The model interface or the native D driver?
[12:51:03] <cheeser> the native D driver
[12:51:15] <cheeser> personally, i
[12:51:26] <cheeser> personally, i'm working on a kotlin driver. from time to time.k :)
[12:51:35] <m3t4lukas> @cheeser how do you connect to mongodb in D right now?
[12:52:05] <m3t4lukas> via C driver or do you use vibe.d with all that unnecessary overhead?
[12:53:29] <cheeser> i don't use D. just a fan. i'm a JVM guy. :D
[12:53:52] <m3t4lukas> ah, okay :D I'm a compiler guy :D
[12:54:03] <m3t4lukas> anything that compiles
[12:54:23] <m3t4lukas> I like speeeeeed
[12:54:52] <cheeser> java compiles.
[12:55:06] <m3t4lukas> into bytecode
[12:55:10] <cheeser> sure
[12:55:24] <m3t4lukas> yeah, not a big fan of bytecode either
[12:55:40] <cheeser> it's a ginormous chunk of the future, i think.
[12:56:17] <m3t4lukas> as soon as people don't give a damn about cost it will be, yes
[12:56:21] <m3t4lukas> *as long
[12:56:45] <cheeser> for most cases, it's right choice. for system/OS code, probably not
[12:57:03] <m3t4lukas> don't see why
[12:57:41] <m3t4lukas> I mean the right build tools and the platform does not matter anymore
[12:57:59] <m3t4lukas> just build it for every system out there and you are good to go
[12:58:37] <m3t4lukas> as long as the languages' standard lib covers os interaction
[12:59:31] <m3t4lukas> or if you only care for unixoids, as I do :P
[13:03:06] <StephenLynx> >building for anything but GNU/Linux
[13:03:18] <StephenLynx> is like you don't even love your mom :c
[13:08:38] <m3t4lukas> yeah, right
[13:09:13] <m3t4lukas> that's why I wonder why companies like Autodesk don't compile their stuff for linux...
[13:09:32] <m3t4lukas> Or adobe
[13:09:41] <m3t4lukas> They already compile for Mac
[13:09:51] <m3t4lukas> why not yet another posix?
[13:11:09] <StephenLynx> demographics.
[13:11:26] <StephenLynx> it works like this
[13:11:43] <StephenLynx> they pick a bunch of people that they want to target as customers.
[13:11:57] <StephenLynx> then they look at the percentages that use each OS.
[13:12:14] <StephenLynx> after that
[13:12:19] <cheeser> profit!
[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?
[13:19:22] <StephenLynx> http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
[13:20:02] <jecran> cool guys I will read up.. thank you
[13:45:06] <_eddy> d
[13:52:27] <benjick> Hi. When I'm updating a doc with a new field all the old fields are removed, what can I do to debug?
[13:52:38] <StephenLynx> you must use $set
[13:52:51] <benjick> ah..
[13:52:54] <benjick> sorry
[13:52:59] <StephenLynx> np
[13:53:38] <benjick> thank you StephenLynx
[13:54:52] <mrmccrac> anyone know if index filters work with inserts/updates?
[13:57:06] <joannac> mrmccrac: updates, it should. inserts, no - how would index filters work there?
[13:57:19] <mrmccrac> true
[13:57:48] <mrmccrac> seeing a strange issue where occasionally it will hit an update query and just hang
[13:57:56] <mrmccrac> after doing other basically identical queries quickly
[13:58:45] <mrmccrac> saw the same behavior on a find() query earlier that i seemed to fix by specifying a hint() for
[14:14:59] <deathanchor> mrmccrac: hints will insure the right indexes are used everytime.
[14:15:43] <deathanchor> I've run queries that used a "stupid" index the first time, but used the "right" indexes after that for a time.
[14:17:46] <mrmccrac> yeah its like it will do 1000 of the updates find
[14:17:52] <mrmccrac> and then do a stupid update all of a sudden
[14:17:54] <mrmccrac> fine*
[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?
[17:42:23] <cheeser> circular reference? what?
[17:42:55] <cheeser> (and since you're in #mongodb you don't need to preface that you have mongodb questions...)
[17:43:18] <kopasetik> @cheeser: this is what i keep getting for my empty database: "TypeError: Converting circular structure to JSON"
[17:43:51] <cheeser> in the shell?
[17:44:34] <StephenLynx> that its because you are probably using JSON.stringify on something that doesn't support it.
[17:44:36] <kopasetik> no, when i run a node script to access the db
[17:44:59] <StephenLynx> that is happening on your application, not on mongo.
[17:44:59] <cheeser> ah. node. not my area of expertise.
[17:46:31] <StephenLynx> if you are not running everything in a try-catch, it should crash and give you the line where it failed.
[17:47:29] <kopasetik> StephenLynx: awesome. just figured it out with that bit of help. thx!
[17:47:55] <kopasetik> and thx to @cheeser for the quick response!
[17:48:09] <cheeser> np
[18:10:56] <_ari> hmm
[18:11:14] <_ari> I want to do $group twice inside my query
[18:11:29] <_ari> first group by Date, then group by product name
[18:11:34] <_ari> and sum costs of products
[18:11:45] <_ari> is that possible?
[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:42] <_ari> ^
[18:14:44] <_ari> that too
[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:17:39] <StephenLynx> I know zero python.
[18:18:08] <sbhawsin> Oh. No problem. Thanks
[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
[18:41:29] <carlgotting> ok
[18:41:39] <mrmccrac> i know this because i had to do that
[18:41:45] <cheeser> you can read and write at the same time
[18:41:55] <cheeser> writes are serialized behind a lock.
[19:32:39] <gabrielsch> a
[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:43:56] <StephenLynx> >"supplies" : { "18" : {
[19:43:57] <StephenLynx> yeah
[19:44:07] <StephenLynx> you have to redo that.
[19:44:22] <StephenLynx> supplied: [{productId:18}]
[19:44:24] <gabrielsch> StephenLynx: index embed collections is a bad practice?
[19:44:27] <StephenLynx> or something instead
[19:44:31] <StephenLynx> yes.
[19:44:35] <gabrielsch> :(
[19:44:37] <StephenLynx> you cannot do much worse than that.
[19:45:25] <gabrielsch> oh shit :(
[19:45:33] <_ari> lol
[19:45:46] <gabrielsch> I've indexed by the productId to be easy to query
[19:45:57] <_ari> i haven't use indexing yet in mongo
[19:46:08] <StephenLynx> it makes harder to query.
[19:46:12] <StephenLynx> because your schema is dynamic.
[19:47:45] <jacksnipe> does mongo 3.x use wiredtiger by default or do I have to specify that?
[19:48:44] <StephenLynx> no.
[19:48:59] <StephenLynx> and many wouldn't advice wt on production in its current state.
[19:49:06] <gabrielsch> StephenLynx: when I designed that, I thought that would help to dont iterate the whole collection
[19:49:20] <gabrielsch> I know the id, then get supplier.supplies[productId]
[19:49:43] <StephenLynx> if the size of that array is a concern, you could look into putting it in a separate collection.
[19:49:50] <StephenLynx> and using fake relations.
[19:50:04] <StephenLynx> to identify which entity parents it.
[19:50:44] <gabrielsch> StephenLynx: what is "fake relations"? references?
[19:51:30] <StephenLynx> I don't consider them to be actual references because mongo doesn't implement relations.
[19:51:38] <StephenLynx> but you can use something like this
[19:52:08] <StephenLynx> collection parents: {someId:x},{someId:y},{someId:z}
[19:52:16] <gabrielsch> I'm using Doctrine ODM, you know? like mongoose
[19:52:35] <StephenLynx> collection children: {parentId:x},{parentId:x}, {parentId:y}
[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:24] <StephenLynx> control*
[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:18] <GothAlice> http://docs.mongodb.org/manual/reference/operator/update/addToSet/
[19:57:24] <jacksnipe> cool thanks
[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 :(
[19:58:43] <GothAlice> {'supplies': {'$elemMatch': {'sku': '…'}}}
[19:58:54] <GothAlice> The "outer field" on an $elemMatch should be the array.
[19:59:10] <GothAlice> (The "inner fields" are then fields on those embedded documents.)
[19:59:57] <gabrielsch> GothAlice: but sku is an object on my schema
[20:00:01] <gabrielsch> like this
[20:00:11] <StephenLynx> again, that pattern is awful.
[20:00:13] <gabrielsch> supplies[id].sku: sku: 123
[20:00:20] <GothAlice> …
[20:00:24] <gabrielsch> I know StephenLynx, and I will migrate it soon
[20:00:28] <gabrielsch> but now I need to solve that
[20:00:32] <GothAlice> gabrielsch: Could i see an actual document in JSON form?
[20:00:50] <gabrielsch> GothAlice: sure, https://gist.github.com/gabrielsch/d8ee8b11fa9002ecfac9
[20:00:51] <GothAlice> supplies[id].sku: sku: 123 is meaningless to me. :/
[20:00:59] <GothAlice> Beauty.
[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:09] <GothAlice> Supplies isn't an array.
[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:03:08] <gabrielsch> GothAlice: oh, thanks :P
[20:03:16] <GothAlice> Done: https://gist.github.com/amcgregor/0afd451d23e068d0eb7d
[20:03:27] <gabrielsch> btw, let me show you what doctrine let me use
[20:03:27] <GothAlice> You can see from the revision history what I changed: https://gist.github.com/amcgregor/0afd451d23e068d0eb7d/revisions
[20:03:45] <gabrielsch> GothAlice, http://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/reference-mapping.html#reference-many
[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:05:06] <gabrielsch> Oo
[20:05:12] <gabrielsch> haha
[20:06:56] <GothAlice> layout.css isn't loading.
[20:08:32] <GothAlice> Ah, okay, I see now. Yeah, you read more into that example than was written.
[20:08:32] <gabrielsch> GothAlice: btw, it supports me 4 types of relations
[20:08:41] <gabrielsch> embedOne, embedMany, referenceMany and referenceOne
[20:09:04] <gabrielsch> today I'm using embedMany, that creates a nested collection, without an _id
[20:09:14] <GothAlice> Sorta.
[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:25] <StephenLynx> lol
[20:12:31] <gabrielsch> GothAlice: yes, Doctrine ODM is still beta, and it's missing a lot of feature
[20:12:36] <StephenLynx> its crap.
[20:12:37] <gabrielsch> but for ORM it rocks
[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:03:36] <joannac> fllr: mongo --host hostname:port --eval 'rs.initiate(yourconfighere)'
[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 ....
[23:36:33] <joannac> yes
[23:36:57] <joannac> you had 5 total. an odd number, > 3
[23:37:20] <joannac> try with 4 total and shut down 2 members
[23:37:41] <cornfeedhobo> hmm. brb