[00:48:10] <StephenLynx> are you sure your server isn`t accepting more than 100?
[00:48:51] <jtthedev> it will accept more than 100 from different host
[00:48:58] <jtthedev> i can have 500 host connect, that's fine
[00:49:07] <jtthedev> i need a single host to be able to connect more than 100 times
[00:49:30] <zamnuts> joannac, thanks for the help, turns out I had old mongodb IP addresses listed in the firewall, never updated them with the new api-agents.mongodb.com A records.
[00:50:17] <StephenLynx> I think your problem is with your application refusing to open more than 100 connections
[00:50:31] <StephenLynx> or you are leaking connections
[00:50:44] <jtthedev> my application is fetching objects from a remote api
[00:50:56] <jtthedev> when it's iterating over the objects to insert into mongo
[00:51:00] <jtthedev> it will not insert more than 100
[00:51:10] <StephenLynx> are you making sure you are reusing connections?
[00:52:13] <StephenLynx> you don`t open a new connection for every single operation, thats a big no-no.
[00:52:33] <StephenLynx> many drivers use their own connection pool, though.
[00:52:36] <zamnuts> jtthedev, your driver should have a "poolSize" option for server, i.e. in the node.js mongodb driver, we have the following available: {options:{server:{poolSize:2}}}
[00:53:13] <zamnuts> jtthedev, but like StephenLynx said, your pool size should not reflect the number of operations.
[00:53:20] <jtthedev> zamnuts, it is a nodejs driver.
[00:53:28] <jtthedev> if you are fluent in node... please review https://gist.github.com/jterrero/f70c68b6754ee55b353b
[00:53:44] <zamnuts> if you want to bulk insert, consider buffering into an UnorderedBulkOperation http://mongodb.github.io/node-mongodb-native/2.0/api/UnorderedBulkOperation.html
[00:53:49] <jtthedev> i'm new to node/mongo... i'm a rails developer making the transition to mean
[00:54:45] <jtthedev> thank you, the guidance is greatly appreciated... nodejs/mongo are new waters for me. i've been working with rails and relational backends for years now
[00:54:55] <jtthedev> rewiring my brain to think node/nosql is a bit of a task
[01:00:54] <zamnuts> no, native driver is good, jw
[01:00:57] <StephenLynx> and what I provided is just an example of how to handle connections in an effective manner
[01:01:19] <StephenLynx> how you can just open the connection, get the collection reference and keep using this reference.
[01:01:26] <StephenLynx> that is what you should absorb from that.
[01:01:59] <zamnuts> jtthedev, your application should have a main file, usually "index.js" ... this is where you'll perform a MongoClient.connect(...), then store the "db" result of the connect callback in a "global" (*cringe*) variable of some sort
[01:02:42] <StephenLynx> having a module that handles it is a much better design.
[01:02:42] <zamnuts> StephenLynx, sorry, i'm not implying global.db or something similar
[01:03:03] <zamnuts> StephenLynx, i agree, a module that handles it will be more singleton-like
[01:03:23] <StephenLynx> not like you have much of an option with the require system.
[01:03:37] <zamnuts> anyways, jtthedev, how you store the ref to db is wide-ranging, but then in any submodules of the application should reference that single db pointer
[01:03:38] <jtthedev> ok.. so, in rails I have written over the past 3 years about 16 - 18 apps that are in production and used every day within my organization. I am making the switch to node and am trying to tackle them one by one. I am doing it in order of easiest to dificult of what the development process was for me.
[01:03:58] <jtthedev> I know some JS for frontend stuff that I have used in rails views
[01:04:12] <jtthedev> but this is my first dirve into using js for the entire stack
[01:04:15] <StephenLynx> first: how imports are handled.
[01:04:41] <jtthedev> about 3 of my apps revolve around importing data frome external sources
[01:04:53] <StephenLynx> every source file will be a module on its own that will be converted to a module in a singleton architecture.
[01:05:00] <StephenLynx> when you use require, you get the instance of the module.
[01:05:32] <StephenLynx> second: callbacks. they are the most efficient way to handle async, just make sure you don't nest them. call a separate function when you finish with a callback
[01:05:54] <StephenLynx> this second point is the most common trap people new to node fall into.
[01:06:02] <StephenLynx> and its called "callback hell"
[01:06:28] <jtthedev> hahaha, i can see why.. trust me, i've had my few share of issues with callbacks while making this transition
[01:06:40] <StephenLynx> personally, I nest them ONCE often, because I wrap the inner async in comment and then theres no way to confuse stuff, but is not exactly kosher.
[01:09:25] <StephenLynx> I understand their use in libraries, but I don't think its a good idea to use them on purely application code.
[01:10:00] <StephenLynx> IMO, it makes much harder to understand the system's logic when you use them
[01:10:33] <StephenLynx> specially when people implement inheritance.
[01:10:39] <StephenLynx> then it becomes a black box
[01:10:41] <jtthedev> heh, funny enough. you guys seem to be cooler then the guys in node.js.... they preach to stay away from mongodb, not sure why. I personally am not a fan of mongodb, mostly due to my career as a dba.. the only nosql databases to impress me so far are graphdb's, but I am sure there are applications where mongo makes a lot more sense than a relational db
[01:11:00] <StephenLynx> node`s community is one of the worst I have ever met.
[01:11:03] <StephenLynx> I avoid it like the plague.
[01:11:03] <jtthedev> StephenLynx, do you know where I can start research for node/mongo on iterating over remote api's for my application ?
[01:12:24] <StephenLynx> "OH, YOU ARE NOT A FEMINIST? DING DONG BANNU CHECK YOUR PRIVILEGE"
[01:12:26] <zamnuts> in fact, someone just said "don't use jshint or jslint" ...dafq
[01:12:45] <StephenLynx> and when they say "I don`t want to write code, I just want to let dependencies do all the work"
[01:13:13] <StephenLynx> "my application has only 100 LOC, don't mind the fact it uses over two dozens of dependencies"
[01:13:22] <jtthedev> i'm not easily swayed, i listen and read for as long as i can before forming my own opinion.... eg, they told me to stay away from mongodb and i was doing it all wrong... but here I am still trying to figure out how to go about solving my issue
[01:13:45] <StephenLynx> I think I can provide you another example
[01:14:07] <StephenLynx> because only recently I figured out the proper way to iterate over something in async properly
[01:14:58] <StephenLynx> the entry point it on that line
[01:15:19] <StephenLynx> then I have to iterate the object in the parameters.files array in async
[01:15:40] <StephenLynx> so when the operation for each file finishes, I have to execute exports.saveUploads again
[01:15:49] <StephenLynx> you could do that on two ways:
[01:16:00] <StephenLynx> one is to directly call saveUploads once the operation is finished
[01:16:05] <zamnuts> StephenLynx, dude, that "two dozens of dependencies" drives me nuts, when you have more deps than lines of actual logic, there's a problem IMO
[01:16:23] <StephenLynx> and the other is to ONLY let saveUploads call saveUploads once each file is finished.
[01:17:02] <StephenLynx> what is the problem with the former: you will have to pass around ALL the parameters saveUploads requires and are used only up to a certain point of the operation that processes each file
[01:17:32] <StephenLynx> when you make a separate callback to the operation that processes each file, you stop passing parameters once they are no longer used in the operation
[01:17:56] <StephenLynx> because the callback will be treated at saveUploads, which already has these parameters.
[01:18:29] <jtthedev> I would rather call after it's finished
[01:18:34] <jtthedev> how long have you been working with node
[01:19:04] <StephenLynx> java, unrealscript, C++, obj C
[01:19:20] <StephenLynx> and I used to do that, and heres the problem:
[01:19:26] <StephenLynx> maintenance became harder and harder
[01:19:34] <StephenLynx> because js doesn`t validate parameter types
[01:19:46] <StephenLynx> so it became easier and easier to screw up the order of parameters
[01:20:25] <StephenLynx> when you apply the pattern I described, you separate the structure of the iteration from the structure of the processing of each iterated element.
[01:20:32] <jtthedev> my previous experience is limited to ruby/plsql
[01:20:50] <jtthedev> and not sure if plsql would really count since it's limited to oracle's db
[01:20:53] <StephenLynx> notice how long the process is for these files.
[01:25:53] <StephenLynx> what I do is to each part of the process to initiate a new callback and pass it to the next part.
[01:26:03] <StephenLynx> if a part fails, it returns an error in its callback
[01:26:34] <StephenLynx> then the part sends the received callback to the function that reverts what it did previously and have the reversal function to execute the callback
[01:29:50] <StephenLynx> because you won't keep resources doing nothing
[01:29:56] <jtthedev> ruby i learned self taught. I'm a pretty decent developer, but with nodejs, I am not going to be going the same route. I am preparing as much as possible, before I start classes on Jan 10th, 2016. I was able to get in, (8% acceptance rate) and the test was a decent study, I had to take it twice before I finally passed. and even passing the test doesn't get you in, you still have to go through like 4 interviews.
[01:30:03] <jtthedev> what do you htink of this curriculum ?
[01:34:26] <StephenLynx> you asked what I think of this course, I say its crap.
[01:34:28] <jtthedev> i use vim at home.... RubyMine at work
[01:34:43] <StephenLynx> they pad it alot to make it look like its worth
[01:34:51] <jtthedev> what are your issues with express/angular
[01:34:52] <StephenLynx> but left out the most important subject you learn in a classroom
[01:35:13] <StephenLynx> any framework that doesn't abstract something meant to be abstract is useless by design
[01:35:22] <StephenLynx> specially at the front-end
[01:35:37] <StephenLynx> and express particularly is a bad piece of software
[01:35:47] <StephenLynx> bad performance, vulnerabilities, bad design
[01:35:53] <preaction> angular abstracts quite a bit away, most people argue it does too much
[01:35:56] <jtthedev> have you ever dablled with the rails framework ??? Ideally I would like to use node with a framework that will give me a similar MVC development pattern
[01:35:59] <StephenLynx> they just picked trendy stuff
[01:36:14] <StephenLynx> thats a very, very bad practice
[01:36:24] <StephenLynx> to throw everything into a big pile of mud
[01:36:30] <StephenLynx> and try to fit every problem into the tool
[01:37:01] <StephenLynx> the key to good mvc is ignoring the fact a GUI exists in your core back-end design.
[01:37:23] <preaction> sure. you need a limited scope. but how limited can be up to debate. the web framework i use, mojolicious, has its own implementation of a lot of stuff. like django does
[01:37:26] <StephenLynx> when you use a tool that tangles all that together, its not modular anymore.
[01:37:53] <StephenLynx> and you start to have issues cropping up and down
[01:37:59] <StephenLynx> because everything is tangled by the framework
[01:38:30] <StephenLynx> and by up and down, I mean these issues affect all layers of the software
[01:38:43] <StephenLynx> they start at a layer and move through all of them
[01:39:01] <jtthedev> if i could find a a framework that works the way the rails framework works, but gives me nodejs as the backend.... that's what I would be looking at... node is a lot more flexible then ruby is
[01:40:27] <StephenLynx> from here you write data to the response object and fetch request data from the request object.
[01:40:52] <StephenLynx> and this reduces overhead. this reduced overhead reduces dev time.
[01:41:04] <preaction> and then you build routines to help you write to the response and read from the request, and then you move those routines into a module, and perhaps start building abstraction, and now you've got a web framework!
[01:41:11] <jtthedev> i've written production apps in less then a week sometimes... not sure i would have been able to achieve that without a framework that already has a pattern in place
[01:49:32] <jtthedev> StephenLynx, this is my argument with frameworks
[01:49:54] <jtthedev> if there's something already out there, that's going to cut down my time in putting an application into production
[01:50:12] <jtthedev> and I have to use some "modules" or "libraries" that someone else wrote (in my case gems for rails)
[01:50:21] <jtthedev> then I am absolutely going to prefer to go that route
[01:50:28] <jtthedev> as it makes me more productive
[01:50:31] <StephenLynx> ok, I will be a little flexible here and give my personal view on a valid use case:
[01:50:59] <StephenLynx> if you have already mastered the base tool and can easily figure out what a framework is doing under the hood
[01:51:19] <StephenLynx> then I say its a valid use case for a framework for the productivity gain.
[01:51:42] <jtthedev> I work for a distributor, very fast pased environment... i'm not building top secret ish for nasa or the nsa... I don't need to write every single piece of code in my app if there's something already out there that will do a fucntion for me
[01:51:46] <StephenLynx> because you could easily do those things and if anything goes wrong, you know what went wrong.
[01:51:54] <jtthedev> for me, it's going to be how fast i go from zero to deployment
[01:52:02] <jtthedev> and a framework imo, gets me there a lot faster than not using one
[01:52:12] <jtthedev> so when I look at things like rails, or express
[01:52:16] <jtthedev> they make a lot of sense for me
[01:52:33] <jtthedev> then having to manually take care of a bunch of stuff that I already had a quicker route to get there and do the same exact thing
[01:52:36] <StephenLynx> I can agree on that, but IMO, when you use a framework without a solid experience with the base tool, you will eventually end up with some big issue that you can`t figure out.
[01:56:42] <StephenLynx> but I am more of a RnD guy
[01:57:06] <jtthedev> but if you ended up in a culture like mine.. and you are 1 of 2 developers, and one developer uses a framework and leverages it, in you're both working on very similar apps for 2 departments.... he might outperform you most of the time
[01:57:08] <StephenLynx> I have recently introduced cutting edge tech in the company with a real-time chat module using websockets
[01:57:26] <StephenLynx> and worked on a C software that reads serial input
[01:57:49] <StephenLynx> currently I am tasked with OCR research but I am not familiar at all with that, so is going slow.
[01:58:18] <StephenLynx> I don`t worry with others are doing too much.
[01:58:37] <StephenLynx> I take my time to see if I can learn anything from them, but usually I take myself as measurement.
[01:58:38] <jtthedev> i work for a distributor, my applications are usually built around getting rid of manual processes (it sucks, a lot of people have lost their jobs as a result of something i've developed)..
[01:58:59] <StephenLynx> and I think a lot about long-term
[01:59:24] <StephenLynx> so I rather have a slow build-up to the project`s productivity and ensure it will be the best possible when it`s complete.
[01:59:48] <StephenLynx> and the documentation and specs will be the closes thing to perfection too.
[02:00:16] <jtthedev> last application i built..... we have a customer who has 230+ locations in the eastern US... sends all his orders electronically via email attached as an html file.... prior to the app, the orders were printed out an manually entered into our ERP, it would take 3 customer service reps, all day to key in those orders
[02:00:26] <jtthedev> the process was cut down to 5 minutes a day and now the orders are imported
[02:01:34] <jtthedev> but building it with rails, made the development process structured, simpler and easier to go back to and make adjustments if needed one day
[02:01:37] <StephenLynx> how long was the development cycle for it?
[02:01:58] <jtthedev> 2 weeks dev, 1 week test then deployed into production
[02:02:23] <StephenLynx> yeah, I will be honest: for such a short development cycle, the impact of not using a framework is much larger.
[02:02:24] <jtthedev> could have been quicker. but our ERP is a POS
[02:02:53] <StephenLynx> but IMO, it wouldn't make much of a difference after the two month mark.
[02:03:06] <jtthedev> i just resigned for 3 years, so i'll be here through 2019... one of my goals is to replace the erp with something we build in house
[02:08:32] <StephenLynx> evaluate is a can of worms too
[02:09:23] <jtthedev> alright, it's been aweoms chatting with you today, going to get back to my mongo / node issue with the remote api call... i've added this channel to the list, i'll be in here more frequently in the coming months
[02:24:55] <macwinner> any tips on a clever methodology to generate an array of tags and their associated posts.. i current have an array of posts which have a subdocument of array of tag objects. post = { title: String, tags: [{text: 'tagtext1'}, {text:'tagtext2'}]}
[02:25:22] <macwinner> i want to have a flat object or array where I can lookup a tag name and see all posts associated with it
[03:07:21] <macwinner> and just iterate over them?
[03:07:34] <macwinner> either way don't i have to iterate?
[03:10:08] <cheeser> i don't see any reason the tags should be documents and not just strings, no.
[03:12:22] <macwinner> k, i'll just make them strings
[14:37:20] <m3t4lukas> why is there no collection.findOne() in the java driver although documented?
[14:40:03] <m3t4lukas> there's only findOneAnd... methods
[15:05:07] <whaley> m3t4lukas: eh? what are you looking at? DBCollection certainly has those defined: https://github.com/mongodb/mongo-java-driver/blob/master/driver/src/main/com/mongodb/DBCollection.java#L648-L765
[15:16:32] <m3t4lukas> I use MongoCollection or should I be using DBCollection?
[15:17:20] <m3t4lukas> if MongoCollection is deprecated it would be nice if it was marked as deprecated
[17:34:01] <Derick> http://stackoverflow.com/questions/17601292/how-do-i-configure-mongodb-replicaset-using-elastic-ips-in-ec2 has hints (in the non accepted comments) too
[17:37:19] <THK> Derick:that looks like it is for ec2-classic.. as it mentions that SecurityGroups are ingress only.
[17:37:43] <THK> in vpc Environments you can control ingress and egress in securityGroups
[17:37:48] <Derick> ok, those words mean nothing to me :)
[17:57:17] <BadApe> i know this probably isn't possible but is it possible to generate a json schema based on a document? yes i can do it in code, but can mongo do it for me?
[17:58:56] <Derick> MongoDB itself can not, but we are working on a tool to help with this
[17:59:28] <THK> oo, is there a mailing list i can get on for that information?
[18:01:37] <Derick> hmm, I presume it's the standard announcement list.
[18:01:47] <Derick> trying to find an online thing, but nothing "official" yet