PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 27th of December, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[12:26:07] <the_voice_> https://jira.mongodb.org/browse/SERVER-1243
[12:26:14] <the_voice_> This is a pretty big problem with Mongo I am trying to solve
[12:27:28] <the_voice_> currently I have one document per comment and then inside the comment document I store the replies as an array of documents. Each one of those embedded documents contains the userID and the reply text
[12:28:10] <the_voice_> sometimes I need to update the userId or text and to do that right now the best solution I have found is to pull out the whole reply array, update the embedded documents inside the array and then push it back to the parent document
[12:28:14] <the_voice_> is there a better solution?
[12:44:00] <the_voice_> StephenLynx here?
[12:44:18] <StephenLynx> yes
[12:44:25] <the_voice_> How are you?
[12:44:30] <StephenLynx> v:
[12:45:03] <the_voice_> :D
[12:45:14] <the_voice_> any ideas about my above question?
[12:45:30] <the_voice_> Is the question clear
[12:45:36] <StephenLynx> I also update manually the documents in the array and then set it back.
[12:45:52] <the_voice_> So you pull the array and then set it back
[12:45:55] <StephenLynx> other option would be having a separated collection and fake relations.
[12:45:56] <StephenLynx> aye
[12:46:03] <StephenLynx> I got similar issue on lynxchan.
[12:46:10] <StephenLynx> but my arrays are simple.
[12:46:15] <the_voice_> the one concern I have is if someone makes a reply at the exact time I update the array
[12:46:22] <StephenLynx> yup
[12:46:25] <the_voice_> It could in theory mess things uo
[12:46:27] <StephenLynx> you got a race condition there.
[12:46:39] <StephenLynx> arrays are not a bed of roses.
[12:46:48] <StephenLynx> you know what you could do?
[12:46:55] <StephenLynx> hm
[12:47:01] <StephenLynx> hold on
[12:48:14] <StephenLynx> here
[12:48:20] <StephenLynx> you could push all new values
[12:48:26] <StephenLynx> https://docs.mongodb.org/v3.0/reference/operator/update/pull/
[12:48:35] <StephenLynx> then check if the array needs to be pruned
[12:48:48] <StephenLynx> and then pull all values that need to be removed.
[12:49:03] <StephenLynx> this way eliminates race conditions at the cost of more operations on the db.
[12:50:03] <StephenLynx> oh, wait
[12:50:12] <StephenLynx> I didnt understood your problem.
[12:50:26] <StephenLynx> you are updating multiple sub-documents?
[12:50:39] <StephenLynx> you could try a bulk write.
[12:50:47] <StephenLynx> with a series of updateOne
[12:51:46] <the_voice_> yah
[12:51:50] <the_voice_> one sec
[12:56:48] <the_voice_> http://pastebin.com/XM5bFgUN
[12:56:54] <the_voice_> okay that is the scenario
[12:57:15] <the_voice_> say I need to find all of the comments with a reply from userId:'ajsodf',
[12:57:28] <the_voice_> and I want to update each one of those replies. How would I go about doing that
[12:58:59] <the_voice_> So I find the comments and then loop through them
[13:00:08] <the_voice_> and then right now what I am doing is copying the array, looping through it and resetting it
[13:09:49] <the_voice_> StephenLynx I'll look at the option of maybe doing a bulk update
[13:10:43] <StephenLynx> yeah, each updateOne would update an index on the array
[13:11:00] <StephenLynx> and if you use push to add new comments, they will always be added at the end of the array
[13:11:19] <StephenLynx> so the indexes wont get messed while you do that.
[13:11:24] <the_voice_> That would work
[13:11:25] <the_voice_> thanks
[13:11:27] <StephenLynx> np
[15:04:54] <itaipu> is there any mongodb public available for developers ? I tried cloud.mongodb.com but it seems it just manages the deploys, doesn't offer the service ( the options are to use aws or local)
[15:17:52] <cheeser> you mean public hosting of mongodb instances?
[15:23:08] <itaipu> cheeser: public in the sense that I can use it; have my collections there, just for testing the application that is in heroku now
[15:24:45] <itaipu> cheeser: I don't want or need to manage any virtual instance... just have a mongodb host available
[15:27:28] <cheeser> you can't run it locally?
[15:29:32] <itaipu> Yes I can, but the test here is not for the mongodb, is for the application running on cloud, so others can test it...
[15:30:35] <itaipu> And I can't make it available from my local deploy
[15:31:13] <cheeser> ah. i see. one sec.
[15:31:42] <cheeser> and aws isn't an option? cloud manager has a trial period.
[15:32:39] <cheeser> i would recommend cloud manager first but here are other options: https://mongolab.com/ , https://www.compose.io/ , http://objectrocket.com/
[15:33:18] <itaipu> cheeser: yeah it is, I had an old account there, and of course I forgot the password, but worst, aws needs my zip code to recovery it and I'm having trouble with this part of recovery now...
[15:34:55] <itaipu> cheeser: thks, I give a try on those :)
[20:52:28] <christo_m> any reason why an insert with monk wield yield an undefined item in the callback, even though the insertion is successful?
[20:52:31] <christo_m> would*