PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 28th of July, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[02:56:11] <Jonno_FTW> why was the collection.save(doc) method deprecated in pymongo?
[03:00:55] <cheeser> http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.save
[03:17:00] <Jonno_FTW> cheeser: I know it's deprecated, I wanted to know why
[12:05:21] <Ange7> hey all
[12:09:46] <Ange7> Someone can help me to get the right pipeline for this problem : http://pastebin.com/fXDcnJuu
[12:14:25] <Ange7> nobody ?
[12:31:34] <Ange7> someone can help me ?
[12:37:00] <cheeser> Jonno_FTW: https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst
[12:37:07] <cheeser> conforming with that spec is why
[12:53:10] <seiren> Hi guys, i'm getting the following error in my NodeJS App with MongoDB. Please msg me as i'm about to go away from my desk. Thank you. MongoError: server 127.0.0.1:27017 received an error {"name":"MongoError","message":"write EPIPE"}
[13:15:50] <StephenLynx> are you using mongoose too?
[13:15:56] <StephenLynx> http://stackoverflow.com/questions/30042119/mongoerror-write-epipe
[13:16:16] <seiren> I'm not, no.
[13:16:35] <StephenLynx> anyway, the document is too big, it seems.
[13:16:57] <seiren> How can the document be too big? And which document? There are a few.
[13:17:18] <StephenLynx> the limit for documents is 16mb.
[13:17:36] <seiren> None of them are anywhere close.
[13:18:36] <seiren> one second
[13:18:39] <StephenLynx> what about nesting?
[13:18:58] <StephenLynx> here it says you can't nest more than 100 times on a document.
[13:19:30] <seiren> Define nesting. Do you mean subdocuments or inserting objects?
[13:19:37] <seiren> Either way, they don't nest too far
[13:19:42] <StephenLynx> hm
[13:19:44] <seiren> it doesnt always happen either :/
[13:19:57] <StephenLynx> It seems the error is ACTUALLY about the connection being shutdown by the server.
[13:20:08] <seiren> the collection.totalSize() returns 49136
[13:20:19] <StephenLynx> what is there between you and the server?
[13:20:23] <cheeser> yeah. document size errors are usually pretty obvious
[13:21:12] <seiren> Both the app and server are on the same machine with no passwords etc between them. There's another server using the same database, which has no issues.
[13:21:16] <seiren> Setup is exactly the same.
[13:21:22] <seiren> hmm, actually
[13:21:44] <seiren> one thing. I'm using express. I'm not closing the connection to mongo at the end of the response. Do you think that would make the difference?
[13:21:47] <StephenLynx> which mongo and node version are you running?
[13:22:23] <seiren> MongoDB shell version: 2.6.12
[13:22:25] <seiren> Node: v0.10.45
[13:22:29] <StephenLynx> daaaaaaaaaaaamn
[13:22:35] <StephenLynx> update it :v
[13:22:38] <StephenLynx> like, now.
[13:22:41] <StephenLynx> specially node.
[13:22:59] <seiren> I don't think updating is the issue here, as one server works and one doesnt
[13:23:19] <StephenLynx> you are using versions so old that it might as well be.
[13:23:29] <StephenLynx> some weird edge case that was fixed.
[13:23:56] <seiren> Lets deal with one issue at a time. Would not closing the connection to mongo at the end of the response in express cause this?
[13:24:05] <StephenLynx> no.
[13:24:19] <StephenLynx> if express isn't totally shit, it should be using the mongodb driver.
[13:24:29] <StephenLynx> which manages its own connection pool.
[13:24:32] <StephenLynx> i'd try without express too.
[13:24:34] <StephenLynx> its garbage.
[13:24:54] <seiren> express doesn't handle the database connections. I'm using the standard mongodb driver.
[13:24:59] <StephenLynx> ok then.
[13:25:28] <StephenLynx> you have 2 things to try:
[13:25:30] <seiren> but, the database call is made when a request hits express.
[13:25:52] <StephenLynx> yeah, but if you handle the driver directly, express has no chance to do anything with it.
[13:26:01] <StephenLynx> one is the TCP stack of the server.
[13:26:02] <seiren> and the only difference between working server and not working server is that the working server closes connection on express response end.
[13:26:12] <seiren> ^
[13:26:16] <StephenLynx> closes connection?
[13:26:19] <StephenLynx> what do you mean?
[13:26:31] <StephenLynx> the mongodb connection?
[13:27:11] <seiren> Yes. it is created on the beginning of the request.
[13:27:22] <StephenLynx> that is EXTREMELY inefficient.
[13:27:31] <StephenLynx> you want to open a connection and reuse it.
[13:27:39] <StephenLynx> and let the driver manage the connection pool internally.
[13:27:53] <StephenLynx> you might be exceeding the connection limit, maybe?
[13:28:31] <seiren> This is why i asked about closing the connection :). I'll move the connection to the database to the runtime of the server and see if that helps.
[13:28:52] <seiren> IT's frustrating, because it isn't a repeatable issue :/
[13:28:59] <StephenLynx> what do you mean move the connection to the runtime of the server?
[13:29:03] <StephenLynx> its already there.
[13:29:15] <StephenLynx> wtf
[13:29:43] <seiren> No, the connection is made when a request hits express.
[13:29:45] <seiren> As explained.
[13:29:50] <StephenLynx> in the runtime of the server.
[13:30:03] <StephenLynx> you don't seem to know what runtime means.
[13:30:32] <StephenLynx> also, you could check mongo's logs.
[13:30:39] <StephenLynx> maybe theres something there.
[13:31:28] <seiren> Sorry, getting frustrated with this issue and used the wrong word :). I meant execution.
[13:31:46] <StephenLynx> hm?
[13:32:14] <seiren> Don't worry.
[13:32:38] <seiren> I've changed the code so it only makes one connection and we'll see how that works.
[13:32:41] <seiren> Thank you.
[13:33:32] <seiren> The old codebase (before i worked here) was much worse. It wasn't just every request that made a connection. It was on every function that accessed the database.
[13:34:48] <StephenLynx> ayyyyyyyyyyyyyy
[13:34:53] <StephenLynx> lmao
[13:35:06] <StephenLynx> gotta love shitty node programmers.
[13:35:25] <StephenLynx> I swear to god that community is reaching PHP levels of stupidity.
[13:35:49] <StephenLynx> never saw such disparity between tool quality and community quality.
[13:36:08] <seiren> Luckily, mine was just an oversight about where i placed the connection. #excuses
[13:36:11] <seiren> :p
[13:36:14] <StephenLynx> kek
[13:36:33] <seiren> You joke about php levels of stupidity.
[13:36:46] <seiren> The old guy wasn't a node dev. he was actually a php dev.
[13:36:57] <StephenLynx> ::^^^^^^^^)))))
[13:37:21] <StephenLynx> makes perfect sense.
[13:37:49] <cheeser> wow. talk about two worlds colliding. :)
[13:39:20] <seiren> His mindset was "I need to write an API for a Cordova app. *google* I'll follow this tutorial."
[13:39:24] <lowbro> all that hate towards php :(
[13:39:31] <seiren> And now we're stuck with a mongodb full of relational data.
[13:39:36] <StephenLynx> kek
[13:39:59] <StephenLynx> yeah, lots of people lack in the thinking department and blindly follow the mongodb examples.
[13:40:05] <StephenLynx> which are meant to show what you SHOULD do.
[13:40:09] <StephenLynx> not HOW.
[13:41:38] <StephenLynx> lowbro, https://www.google.com.br/search?q=Rasmus+Lerdorf+quotes&tbm=isch&imgil=jORCFQW4Nxn9UM%253A%253BbL3ljHJCVuismM%253Bhttp%25253A%25252F%25252Fwww.networkworld.com%25252Farticle%25252F2987751%25252Fcomputers%25252F21-of-the-greatest-computer-quotes-ever.html&source=iu&pf=m&fir=jORCFQW4Nxn9UM%253A%252CbL3ljHJCVuismM%252C_&usg=__uwmZVSLZ4tz3pssLeTwyChbhdkE%3D&biw=1871&bih=980#imgrc=jORCFQW4Nxn9UM%3A
[13:41:55] <StephenLynx> I think PHP hate is the most justified hate in any programming topic.
[13:43:47] <StephenLynx> http://sendablequotes.com/quotes/102230.jpg
[14:02:11] <mementomori> hi
[14:02:18] <mementomori> seems like mongodb-org for ubuntu 16.04 LTS is missing init scripts
[14:02:42] <mementomori> https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/?_ga=1.80797143.1179970787.1463566727#init-scripts
[14:03:02] <mementomori> $ dpkg -L mongodb-org
[14:03:03] <mementomori> /usr/bin
[14:03:03] <mementomori> /usr/sbin
[14:03:04] <mementomori> /usr/share
[14:03:07] <mementomori> /usr/share/doc
[14:03:09] <mementomori> /usr/share/doc/mongodb-org
[14:03:11] <mementomori> /usr/share/doc/mongodb-org/copyright
[14:03:13] <mementomori> /usr/share/doc/mongodb-org/changelog.gz
[14:03:14] <StephenLynx> I think 16 is not even supported
[14:03:15] <mementomori> /var/lib
[14:03:16] <StephenLynx> and ffs
[14:03:16] <mementomori> /var/lib/mongodb
[14:03:19] <StephenLynx> use pastebin
[14:03:40] <mementomori> StephenLynx, yes it is supported
[14:03:51] <StephenLynx> https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
[14:03:51] <mementomori> sorry for the long paste
[14:03:53] <StephenLynx> is not.
[14:04:04] <StephenLynx> ah
[14:04:04] <StephenLynx> nvm
[14:04:17] <StephenLynx> it actually is.
[14:05:02] <lowbro> StephenLynx: Good thing I don't get offended on the internets :)
[14:05:09] <StephenLynx> kek
[14:05:16] <mementomori> looks like it's not the first time: https://jira.mongodb.org/browse/SERVER-10871
[14:17:55] <mementomori> are those init scripts available online somewhere?
[14:46:14] <mementomori> since this chan is logged maybe someone will find useful this link: http://askubuntu.com/questions/767134/mongodb-3-2-6-init-script-is-missing
[15:02:42] <StephenLynx> i'd suggest running centOS, btw.
[15:02:47] <StephenLynx> much better support.
[15:14:28] <cheeser> i'm not sure 16 is a supported platform yet
[15:14:33] <benjwadams> How can i reduce/clean a mongo database? I'm used to vacuuming in postgres, I don't know what the rough mongo equivalent would be? `clean`? Is there anything that doesn't need a db wide write lock?
[15:15:11] <cheeser> oh, there it is. great.
[15:15:25] <cheeser> benjwadams: db.repair() is the closest
[15:15:47] <cheeser> if you're on WT, this isn't (as?) necessary
[16:59:50] <loadh> hello
[17:00:12] <loadh> is it possible to find documents geographically near another document, give an ObjectId?
[17:00:46] <cheeser> you'd need actual geo coordinates
[17:01:01] <loadh> i'm perfectly able to conduct geoNear and near queries give a set of coords, what I'm asking is whether it's possible to query given the ObjectId
[17:01:17] <loadh> so it's not possible to find nearby documents?
[17:01:25] <loadh> seems like a fairly obvious requirement?
[17:03:44] <loadh> @cheeser so to conduct the query I want, I'd need to first find the document by ObjectId / _id, then get the coords from that doc, then do the search for all docs near those coords?
[17:04:16] <Derick> yes
[17:05:02] <loadh> @derick is there a way to do this in some compound way? (I'm using NodeJS) or would I have to traverse the result set etc.?
[17:05:18] <Derick> I don't know what you mean by that.
[17:05:19] <loadh> as in is there a single query string that could do this
[17:05:37] <Derick> no. You need two queries. One to fetch the coordinates. And one to do the geoNear query
[17:05:39] <loadh> (in SQL you could do a kind of sub-query)
[17:05:54] <loadh> this sounds like it could be sub-optimal performance qise?
[17:05:58] <loadh> *wise
[17:06:06] <loadh> doing two things
[17:06:09] <Derick> a sub query in SQL is also just two queries...
[17:06:15] <Derick> it just happens internally in the DB engine
[17:06:25] <loadh> ok, but maybe in an optimal qay/
[17:06:28] <loadh> *way
[17:07:13] <loadh> ok, thanks @Derick, @cheeser :)
[17:07:54] <loadh> ..wait, what about a pipeline / aggregate thing..could that do it in one fell swoop?
[17:08:27] <Derick> loadh: it can't do what you want.
[17:08:31] <loadh> :(
[17:08:34] <loadh> :)
[17:08:36] <Derick> Just do two queries...
[17:08:45] <loadh> on it :)
[17:34:58] <loadh> is there some problem using find({"_id": "the id value"}).toArray(function(err, res) { })
[17:35:10] <loadh> even though the id exists, the result set is empty
[17:35:19] <loadh> (note, not using Mongoose)
[17:36:48] <Derick> are you wrapped the ID string in an ObjectID object?
[17:38:20] <loadh> string
[17:39:06] <loadh> ok, my bad, that worked!! wrap it in an ObjectID
[17:39:14] <loadh> thanks again :)
[17:39:31] <loadh> (for some reason I thought ObjectID was a Mongoose thing!)
[20:57:50] <energizer> I'd like to write programs on my personal computer that can affect my db on the remote server, and then transfer my code by git to the server when I'm satistfied with it.
[20:58:21] <energizer> But that means having code that can affect the database from home or from the server running the db.
[20:58:32] <energizer> Is there an approach for doing that?
[20:58:56] <energizer> How can I write code at home that will be run by the server?
[20:59:21] <energizer> and also by my computer