[10:37:26] <cppking> hello guys what's the difference of command when create range or hash based sharding collection?
[14:27:31] <cr0mulent> Hello, I would like to query the contents of one collection and insert the results into another collection with an added key value pair. Could someone suggest where I should look in the documentation?
[14:47:50] <r0j4z0> i can run two or more copydatabase in parallel?
[14:49:04] <r0j4z0> y need to copy 10 databases from one server to another and i want to do some parallelization, but i cant find any information /documentation about it
[14:51:42] <r0j4z0> both servers are fresh, mongod only takes about 10% of the cpu and both have plenty of ram available
[15:09:11] <roadrunneratwast> hi. i am a software engineer, not a database guy. can someone recommend a tutorial or book that would help me how to think about data design. i do already have some information in a spreadsheet. but i would like to do some sort of analysis on this data before i just dump it in a a table. also: i have no real way to think about sql vs. nosql. sorry this question is so rudimentary
[15:09:33] <GothAlice> roadrunneratwast: Are you familiar with JSON?
[15:09:45] <roadrunneratwast> yeah sure. i am a javascript dev
[15:10:11] <GothAlice> roadrunneratwast: SQL treats your data like a spreadsheet; in flat tables with rows (records) and columns. All of the SQL "magic" is in combining them in various ways through JOINs.
[15:10:31] <roadrunneratwast> yeah. i have used postgres and mongo
[15:10:40] <roadrunneratwast> and oracle and mysql
[15:10:42] <GothAlice> roadrunneratwast: Document databases like MongoDB store documents, not rows, in collections, not tables. In the MongoDB case, they're like JSON, but with additional types, such as 64-bit accurate integers.
[15:11:16] <GothAlice> http://www.javaworld.com/article/2088406/enterprise-java/how-to-screw-up-your-mongodb-schema-design.html may be useful as a starting point.
[15:13:14] <roadrunneratwast> what i've seen at work is that people make tables which have the columns (eg): NAME, TITLE, DATE, EVERYTHING_ELSE, where everything else is some huge messy json object, i am not saying that nosql encourages such messiness but it makes me concerned about making sure the system is well designed
[15:14:11] <GothAlice> roadrunneratwast: MongoDB has no concept of "tables"; that looks like a misapplication of a relational database, i.e. SQL encourages such messiness.
[15:14:45] <GothAlice> In MongoDB, since your document is effectively just a structured JSON object, there is no need to ever have an "everything else" field. You can always just have more fields.
[15:15:39] <GothAlice> I.e. even within a single collection you can have {name: "Alice"} as one document, and {name: "Bob", knows: ["Alice"]} — i.e. fields that are optional. (There is no particular requirement for every document in a collection to follow the same structure. It's recommended, but optional fields are a thing.)
[15:16:15] <GothAlice> roadrunneratwast: If you are familiar with Entity-Attribute-Value, that is the ultimate attempt by SQL (relational) databases to pretend to be document databases. ;)
[15:17:33] <roadrunneratwast> i think you are a saleswoman
[15:17:42] <roadrunneratwast> you work for the company?
[15:17:49] <roadrunneratwast> it certainly sounds like it
[16:10:30] <cr0mulent> I want to create a query that will take all records from an one collection that match criteria, remove the _id, add a new key value pair then insert that document into another collection. Does this script look like it will work correctly? http://pastebin.com/Etwij9ZX
[16:49:43] <malorie> hi all. I'm trying to add "references" do a document that depend on an array-field of that document. on reference per array-item. but in order to get the required _ids I need to do multiple find()s, and I don't know how to aggregate them, because of the callbacks. any ideas, how to do that?
[17:08:01] <StephenLynx> aggregate everything you need and then do the bulkwrite.
[17:08:10] <GothAlice> Find all of the values you need, build a bulk update, and execute it to set the references.
[17:08:45] <malorie> how do I find all the values I need, though? :x
[17:08:55] <StephenLynx> with a find or aggregate.
[17:09:09] <StephenLynx> I don't think an aggregate is required, though.
[17:09:12] <GothAlice> When the "with" block is left, the bulk write is executed. self.scalar() runs a find, projecting just the fields requested, in this example.
[17:09:31] <StephenLynx> even though it could make your life easier with a group.
[17:09:33] <GothAlice> (So, it's iterating the result of a find, using it to build the "ancestors" list of reference for each thing in the tree.)
[17:16:26] <malorie> I think I can make something off it
[18:27:40] <burgalon> anyone can help with intersection indexes http://stackoverflow.com/questions/39152189/mongodb-query-not-using-intersection-indexes ?
[19:36:07] <Jimu> I've just done csv exports from mongodb using mongoexport.exe and from postgresql using psql.exe of equivalent tables/collections, and postgresql did 40 million records in ~70 seconds, and mongoexport did 23.5 million records in 600 seconds. No query involved in either one.
[20:04:17] <GothAlice> http://www.javaworld.com/article/2077150/scripting-jvm-languages/using-javascript-s-built-in-objects.html < except where it's documented as being interchangeable.
[20:07:36] <GothAlice> Second, basic concatenation of arrays is a… fairly fundamental expectation across languages. The operation is trivial: return a new array that is the combination of the two. Failing to meet basic cross-language expectations means you're learning more JS exceptions than rules.
[20:10:34] <StephenLynx> and you just pointed it to me that + doesn't concatenate arrays in js.
[20:10:50] <GothAlice> Also not sure how strong typing would be a negative impact on this. It'd be a type error to concatenate incompatible arrays, sure.
[20:10:56] <StephenLynx> besides, [] are not arrays, they are lists.
[20:11:00] <StephenLynx> they are actually objects.
[20:11:21] <StephenLynx> down to what typeof gives you.
[20:11:28] <GothAlice> StephenLynx: Semantic pedantry an argument does not make, either. In fact, being an object, it has no excuse not to implement the operators.
[20:11:37] <GothAlice> "foo" + "bar" == "foobar". Concatenation. It's a reasonable first step to extend that to other types. (Of course, in a number of languages such as JS or Java the expectation is quickly violated, sending the user off to find the "right" way to do it.)
[20:12:13] <StephenLynx> and is not semantic pedantry.
[20:12:24] <StephenLynx> there is a very clear difference between arrays and lists.
[20:12:42] <GothAlice> Which doesn't matter for the argument for or against the ability to concatenate either.
[20:13:06] <StephenLynx> well, if you are going to arbitrarily pick which arguments are good or not, I am done then.
[20:15:33] <GothAlice> In a similar "they're so different it doesn't matter" sense, tuples and lists in Python are "different"—very different, in some ways, such as mutability and hashability—but behave consistently when used with standard operators. Are consistency, and principle-of-least-surprise, not desirable goals for a language?
[20:16:49] <StephenLynx> it matters if you are going to claim it's a "commonly expected feature".
[20:17:08] <StephenLynx> a C programmer would never expect it.
[20:26:25] <GothAlice> You are speaking of experienced programmers. I'm talking about the look on the face of a developer who is learning, has just learned string concatenation (in nearly any scripting language), then has their reasonable expectation violated almost instantly. But hey, if obtuse is "reasonable", can't argue with that. Enjoy your JS. ;P
[20:27:19] <StephenLynx> since when bad programmers matter?
[20:30:38] <StephenLynx> the problem with javascript is that it doesn't conform with the modern idea that programmers should be cushioned. it is concerned about having a intuitive, lean and cohesive core and expects you to keep yourself away from the bad parts.
[20:30:47] <StephenLynx> and many programmers think that's a flaw.
[20:30:59] <StephenLynx> how dare this language not hold my hand?
[20:31:59] <GothAlice> "Learn to adapt to the mistakes of others" — potentially valuable lesson. On the other hand, "get good or get out" — really poor way of stating such. Abusive, even. I get the distinct sense you've never been a tutor or other educator. You are literally arguing _for_ excessive complexity, which is virtually incomprehensible.
[20:33:53] <StephenLynx> because this is all that good js is about: not using the bad features. there is even a whole mode (strict) dedicated to make it more lean and strict like C.
[20:34:29] <StephenLynx> without ambiguities, without guessing.
[20:37:12] <GothAlice> … you've read through the ECMAScript standard, right? The cost of a lack of ambiguity, in many cases, is multiple pages of organically grown decision tree the developer needs to memorize to not shoot themselves in the foot. And that's just the comparison operator. (Oh, right, == is misuse, === for life.)
[20:37:14] <GothAlice> But hey, you like it, I'll leave it at that. I'm sure you have your reasons for liking it and defending it the way you do.
[20:37:50] <StephenLynx> and heres the best thing about js
[20:38:04] <StephenLynx> unlike broken languages, it NEVER broke backward compatibility