PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 29th of March, 2018

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:44:01] <SDr> hello!
[00:44:29] <SDr> say you have a very simple document store (id, text, authorId). what's the recommended way to do versioning against it?
[05:39:51] <gdadsriver_> I'm trying to build a text editor autosave feature. Each time the user pauses typing in the textarea, I need to save only the newly added text (perhaps by detecting with google diff patch algo) to mongodb. I'm not able to figure out how to append to a string field in mongodb
[05:40:34] <gdadsriver_> or if anything else that is suited for this purpose, which I'm not trying to find out.
[05:42:58] <gdadsriver> I need to be able to write only the new text and not replace/update the whole text that is inside the textarea
[07:19:08] <gdadsriver> I'm trying to build a small app — an auto save feature for a simple text area, wherein as soon as a person stops typing, after a 2 second delay the changes are synced with the help of an express server. The problem statement is that only the text that is changed after the last save (can be detected using https://github.com/google/diff-match-patch), should be sent down to the server to save (patch) in the mongodb database, instead of
[07:19:09] <gdadsriver> re writing with the whole text.
[07:19:09] <gdadsriver> I'm struggling with how the save the diff text incrementally (patch so to speak, with the existing text from the previous save) (append to a string? or implement this with arrays). I can't seem to find a way. Is there a way to do it with strings in mongodb? can we append to a string instead of replacing it? (I haven't been able to find out if one can). How can we go about implementing this? Help would be really appreciated, I've been s
[07:19:10] <gdadsriver> tuck for quite a while.
[08:35:46] <Derick> gdadsriver: I wouldn't store the patch, but just the whole text. Much easier
[08:37:06] <gdadsriver> Derick: There are no performance implications for big amount of texts? (Also this stackoverflow answer (https://stackoverflow.com/questions/23868963/append-a-string-to-the-end-of-an-existing-field-in-mongodb/23870224#23870224) says patch isn't even possible, is it true?)
[08:38:15] <gdadsriver> Derick: It's a part of problem statement I'm given, that I need to only send the newly typed text content value over the server, instead of the whole content. I'm trying to figure out that if only a part of newly typed text is sent over the server after the user stops typing, how to save it?
[08:48:58] <Derick> gdadsriver: what if a user modifies data?
[08:50:56] <gdadsriver> Derick: if a user has written say 'Hi' (which has been saved in the db), and then user adds ' How are you?' then the problem statement requires that I only send ' How are you' over to the server, and then save the content in the database (this is where I'm stuck, how to add onto already saved data)
[08:53:12] <Derick> gdadsriver: and then what if they remove the "How" only?
[08:55:42] <gdadsriver> Derick: That was my next point. I don't know what to do then. If it helps — this is the problem statement : https://www.youtube.com/watch?v=MxKKaBLu790
[08:57:29] <Derick> considering people are not going to write shitloads of text, I will argue it's not worth doing it. As you've already figured, MongoDB doesn't allow you to "change" a string in a field, only to overwrite it. As you can't easily revert patches, the best you can do is to store each full version. That's not really specific to MongoDB though; as you can't really (efficiently) do this with RDBMses either
[08:58:52] <gdadsriver> Derick: I agree :) But it's apparently a job interview problem ¯\_(ツ)_/¯
[09:03:16] <Derick> https://github.com/google/diff-match-patch says it can do patch too. If it can patch in reserve, you should just be able to store the patches in the database. *but*, that would mean you need to apply the patches to an empty string to build up the full text
[09:07:59] <gdadsriver> Derick: I'm sorry I didn't follow what you said, I'll have to look at how it patches, and what would it mean to store a patch and rebuilding for it. If you've got time, could you explain it to me with a one sentence example please? It'd allow me to follow fast.
[09:08:14] <gdadsriver> *from it.
[09:09:46] <Derick> if https://github.com/google/diff-match-patch says it can make patches of text; then you can store each patch as a separate element in the database. In order to build the full text, you just need to execute each of the stored patches in order
[09:15:07] <gdadsriver> Derick: So that means there will be a list of patches that would have to be stored? Right?
[09:17:54] <gdadsriver> Derick: That really is some over doing. I mean if one keeps typing, but then deletes everything — rebuilding from all the patches would just end up in an empty string, isn't it?
[09:41:32] <Derick> yeah
[09:41:48] <Derick> but as I said, the whole concept is a bit over the top :)
[09:47:01] <gdadsriver> Derick: right! Thanks Derick!
[10:03:33] <Sharcho> Is there a way to check if mongod.conf is valid without actually starting the server?
[10:03:33] <yudao> Hi all!
[10:05:22] <yudao> I need some help to know if my aggregation is possible. I've searched and tested a lot of things but I can't do what i'm looking for. And maybe it's not possible. I'm new to mongo.
[10:05:34] <yudao> I've created a simple gist to explain my issue: https://gist.github.com/yudao/5bd57371e97c1ef1207b0b932bb87330
[12:03:58] <Pieplay> Hey guys I've been using aggregates (super cool by the way)
[12:06:33] <Pieplay> But pulling the same data with lookup over and over again seems kinda consuming
[12:06:55] <Pieplay> Can I pipe a data stream, and fold it on its own a couple of times from memory
[12:52:30] <jindraj> Hi, Is it possible to have mongodb with authentication to one specific database and all others without authentication?
[13:01:28] <wouter0100> Hey. I'm running a cluster of different workers written in Node, and all access the same collection using FindOneAndUpdate() to find which item to update (it searches for the oldest and updates the time, so other workers wont receive it). Unfortunately, it seem that 2 workers can receive the same object, although not that often, but they do. Is the
[13:01:28] <wouter0100> re any way to provide "locking" or so to fix this?
[13:09:41] <wouter0100> Although, when i read the docs there seem to be already some restrictions in place which should prevent this, but it does not seem to be working.
[15:11:19] <yudao> I want to make an aggregation to render nested results. I'm trying to lookup, unwind, and group but I can't achieve what I want to do. If somebody could take me on the track of the solution it will be great. Thanks => my gist for understand what I want to achieve https://gist.github.com/yudao/5bd57371e97c1ef1207b0b932bb87330
[15:44:11] <kristian_> Hello, is it possible / a good idea to use the same embedded document in multiple fields in a document? Like this: https://pastebin.com/sLpPKZjH
[15:53:36] <yudao> @kristian_ I'm using it a lot with golang. I prefer for more maintenability. It's more easy
[15:56:44] <kristian_> I'm an absolute beginner when it comes to nosql and mongodb so I was wondering if it's even allowed to do so
[16:38:27] <themagmaforce> i have a doc with {name:'x',list:[]}, and i can add items to the list, but when i select it the list comes empty all the time, how can i retrevie with the list items included?
[16:50:49] <croberts> hi We currently use mongo 2.6 and are looking to switch to 3.4 for our application, we are using the old style conf setting = value and mongo gets setup with the following puppet module:
[16:50:54] <croberts> https://forge.puppet.com/puppet/mongodb
[16:50:58] <croberts> When I try to do engine = mmapv1 if fails to start, is there something I'm missing or does it need to be the new yaml format i tried storage = mmapv1 and that failed too
[16:51:05] <croberts> it*
[18:53:10] <croberts> do i need both storage and engine or can i just put 1 in
[19:31:01] <aarkerio> hi! I'm kind of new on MongoDB, rails stuff, and I see a class named "Credential" with the statement:
[19:31:02] <aarkerio> embedded_in :credentialed, :inverse_of => :credentials
[19:31:30] <aarkerio> so, how can I add a new "Credential" document?
[19:32:41] <aarkerio> I'm getting: Problem: Cannot persist embedded document Credential without a parent document.
[19:41:03] <sivy> g’day all
[19:41:14] <sivy> i am getting steamed at the docs
[19:42:18] <sivy> For $year: “Changed in version 3.6. The argument must be a valid expression that resolves to one of the following: A Date, a Timestamp, or an ObjectID.“
[19:43:20] <sivy> Oh FFS - wrong computer, wrong mongo v
[19:43:34] <sivy> wrongodb
[19:43:39] <sivy> (facepalm)
[20:04:16] <themagmaforce> i'm trying to get an avg of one array i'm not being able to understand how it works on python. i'm doing this "mongodb.mycollection.find(search_text, {'examAvg': {'$avg': "$exam"}})" but getting an error, exam is an array on the root of the document.
[20:29:38] <cslcm> Hi folks - i'm trying to figure out why one of my secondaries isn't electable, what are the primary culprits? It's caught up, health is 1, i can't see why it's not electable
[21:12:34] <Derick> post rs.status() somewhere?