These are chat archives for Automattic/mongoose

19th
Nov 2015
Erinç Fırtına
@EricMcRay
Nov 19 2015 14:02
Guy I just released $in query operation performs very bad even if field has index. I have a query like User.find({provider: { $in: [“facebook”, “twitter"]}}).count() takes too long in about 10m document. But wierd thing is if I run that seperate like User.find({provider: “facebook”}).count() takes about 5 sec. and for twitter it takes about 1-2sec. do you have any idea why this is happening?
Lee Kang
@themlkang
Nov 19 2015 18:57
Hi, I have a node.js script that uses mongoose to update some data in a mongodb database, but for some reason, when it reaches the end of the script, it sometimes hangs and doesn't terminate. Does anyone know what could be wrong? Am I not connecting/disconnecting correctly?
Dawid Pura
@puradawid
Nov 19 2015 20:17
@themlkang can you share your script? Maybe you are calling async methods without any callback or something :)
Dawid Pura
@puradawid
Nov 19 2015 20:25
@dantaex I am not sure that anyone answer you, but it looks like findAndUpdate is just find and then save, without native update execution, am I right?
I remember that I had to change usage of useAtomicUpdate in, well, node-restful "mongoose model", because of similar problem that you have.
Lee Kang
@themlkang
Nov 19 2015 20:56
sure, here is the code (without a few things for obvious reasons): http://pastebin.com/72j6Geci I think I handled everything correctly
Lee Kang
@themlkang
Nov 19 2015 21:17
Any help would be great. I've been banging my head on this issue for awhile :( Is it a bug in mongoose?
Jeroen Rinzema
@jeroenrinzema
Nov 19 2015 21:57
Hello I am having a problem with mongoose. When i try to save new data to my collection does it only save a object containing "_id" and "__v". I checked everything but for some reason does mongoose refuse to use my data. checked on Ubuntu 14.04 and CentOS 6, mongo version 3.0.7, mongoose version 4.2.6
Jeroen Rinzema
@jeroenrinzema
Nov 19 2015 22:41
This is a small snippet that i am using to debug this problem http://pastebin.com/Y3ngfTaJ