[01:27:42] <diegoaguilar> Hello I'm trying to do this to get the "update if found, insert if not found" behaviour, but its not working properly as I get a cannot update lfPoints and lfPoints at the same time
[01:27:48] <diegoaguilar> this is what I'm trying: http://kopy.io/fAWWi
[01:32:36] <Boomtime> diegoaguilar: it is a known problem: https://jira.mongodb.org/browse/SERVER-10711
[01:32:48] <Boomtime> you will need to plan a way around it
[01:34:03] <Boomtime> the easiest way around it is to not require initializing a field (which you want to increment in an upsert) to anything other than zero
[01:34:11] <Boomtime> if you need a baseline, then store that seperately
[01:38:15] <Boomtime> diegoaguilar: two things; 1. that line is the same as an update, 2. you don't need setOnInsert at all in that variant
[01:38:59] <Boomtime> all fields initialize automatically to the equivalent of null/zero as soon as you don't anything with tham - $inc assumes a field to be zero if it doesn't already exist
[01:39:20] <Boomtime> *"as soon as you do anything with them"
[01:39:50] <diegoaguilar> Ok, but I just didnt understand what u said first as workaround
[01:40:03] <diegoaguilar> maybe findAndModify will have the same effect
[04:07:02] <wiltors42> I'm wondering how to return an entire collection from MongoDB in javascript
[04:08:45] <wiltors42> Since the entries are not in any particular order, how do I step through all of them in a loop?
[04:09:15] <wiltors42> Should I make a list of all unames to findOne() with?
[04:57:05] <movedx> MongoDB newbie here. Creating replication sets is a good way of offering data redundancy, backup, and enabling you to create read-only slaves so you can offload read operations to another system. What does sharding mainly introduce? Performance?
[05:36:36] <leptone> i have a collection of cafes with: {name, address, speedTestList} how can i use db.cafes.update() to append a new object to the speedTestList attribute
[05:39:30] <Boomtime> leptone: assuming speedTestList is an array: http://docs.mongodb.org/manual/reference/operator/update/push/
[05:46:35] <leptone> Boomtime, like this? https://gist.github.com/leptone/64f7b8f4801d448505cb
[09:22:22] <Boomtime> then it would do so for the next() and hasNext() loop as well, or you are breaking the rules of NodeJS - which seems likely at this point
[09:22:55] <Axy> no, because I only trigger hasNext recursion in the callback of next
[09:23:03] <Boomtime> next() gets more than one from the server at a time, it merely reveals one to you at a time, exactly the same way that forEach does
[09:23:41] <Axy> Yes but I don't have control to trigger the next-item-operation in foreach
[09:23:51] <Axy> in next- hasnext loop I do -- I can just put things in callbacks
[09:24:00] <Axy> and it only processes one at a time
[09:24:15] <Axy> and after finishing one fully, goesto the next
[09:24:46] <Boomtime> you have serious concurrency issues
[09:27:13] <Axy> I need to process what I already have.
[09:27:16] <Boomtime> you'll probably need to resort of doing the batching the updates yourself - use toArray so you can control the order of things, but do the find in batches of a few thousand or something
[18:34:23] <happiness_color> in a script with javascript Dates
[20:23:23] <asteele> hi all, i am new to using mongo in production and just yesterday started seeing issues in our application where certain endpoints of the api are very consistently taking a very long time (400 - 1200 ms) to return. I am trying now to find out where the issue is, if it is with mongo or some of the code, i am using mongotop and mongostat and according to those two it shows everything happening very fast, never anything above 1-5 ms, is that
[20:23:24] <asteele> telling me the issue is definitely not with mongo - or are there other places to look
[20:24:42] <asteele> ill be idling so if you see this and have any opinions, your time is very much appreciated <3
[20:28:41] <StephenLynx> asteele we will need more details.
[20:28:57] <asteele> StephenLynx sure what would help?
[20:29:10] <StephenLynx> the application source code, what it does in general
[20:29:36] <StephenLynx> does it uses mongoose, by any chance?
[20:29:58] <StephenLynx> mongoose is about 6 times slower than the native node.js driver.
[20:30:25] <asteele> are there some known issues i should look for there? i am not doing tons of complex work but give me one second and ill try my best to explain whats going on
[20:30:56] <StephenLynx> the issue is mongoose being awful.
[20:31:00] <StephenLynx> the solution is not using it.
[20:32:51] <asteele> lol :( fair enough, but part of me thinks a bigger issue might lie somewhere. everything was working fine for many weeks but just recently there is a very noticable delay in lots of the api calls - reading from the db seems to still be quick
[20:33:17] <asteele> i get your concern though i think, its hard to diagnose slowness when you have mongoose in front of it all
[20:33:36] <StephenLynx> the diagnosis is mongoose being mongoose.
[20:34:00] <StephenLynx> you cannot expect to use it and have a good performance with large datasets.
[20:34:30] <StephenLynx> using mongoose is the most common error people make when using mongodb with node/io
[20:35:31] <asteele> but like 500 ms slow? my data set is really not all that big. We have < 2500 users and most of what they are doing is continually updating one document. I AM using like a populate() query and stuff during some of these calls, but like i said to me the weird part is, up until yesterday all of this stuff ran very fast and fine, even using mongoose