PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 13th of November, 2018

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[11:36:53] <rebab> How do I find datas under 5 characters?
[11:42:53] <Derick> strings with less than 5 characters?
[11:44:51] <Derick> You can use the Aggregation Framework with $strLenBytes, and then match against that: https://docs.mongodb.com/v3.4/reference/operator/aggregation/strLenBytes/#single-byte-and-multibyte-character-set
[11:56:41] <rebab> I figure it out using regex ^.{0,150}$
[11:57:28] <Derick> my approach is likely faster
[11:58:41] <rebab> Okay I'll study on it. Is there a way to remove same datas? I have a lot of data in my database. Some of them are the same. I want to remove them.
[11:59:01] <Derick> I don't think there is a database specific way
[11:59:08] <Derick> you'll have to do that in a script or program
[16:03:08] <wfq> Hi all
[16:03:54] <wfq> how can I force that a one to one relationship from document to document ensure that the referenced document exists in the database at saving time. Do I need to do a read first?
[16:04:51] <wfq> I don't want to use embedded documents
[16:11:18] <wfq> or where can I find specific information about constraints in one-to-one relationships please?
[16:11:39] <Derick> there are no foreign keys in MongoDB
[16:16:46] <wfq> Derick, yes. I keep forgetting this. The only way is by firing a reading query and at that mongodb is very fast, I guess the argument would be
[16:17:06] <wfq> Thanks
[16:18:09] <Derick> you should really store these things in one document though
[16:18:29] <wfq> Derick, sorry I am not sure what you mean
[16:18:51] <Derick> there is no point in having a 1:1 relation between documents. Just make it one document.
[16:19:06] <wfq> My problem is that I have a hierarchy where documents are related with each other
[16:19:19] <Derick> that's not 1:1 one then, but rather 1:n ?
[16:19:42] <wfq> Derick, not. A document will only be related to a parent one
[16:19:58] <Derick> but a parent can have multiple children...
[16:20:58] <wfq> I know where you are coming from and suggest me to use a ListField of ReferenceFields instead
[16:21:23] <Derick> these are not MongoDB words...
[16:21:36] <Derick> perhaps they're mongoose words?
[16:21:49] <wfq> Derick, sure... I keep mixing mongodb with RDBMS and MongoEngine with mongodb
[16:21:51] <wfq> sorry about that
[16:22:12] <wfq> I highly regret to have used it and not go with pymongo directly
[16:22:19] <wfq> they are two learning curves
[16:22:22] <Derick> yes.
[16:22:40] <Derick> It's really best to start with the "native" drivers when learning MongoDB
[16:22:59] <wfq> Derick, absolutely agree with that.
[16:23:27] <Derick> what would be *best* in your case, is to do the read, and the write(s) in a transaction
[16:23:46] <Derick> but not sure whether MongoEngine supports that
[16:25:20] <wfq> Derick, here we go, the two learning curves again. I am on the verge to tear it down altogether
[16:25:30] <wfq> Derick, thanks. I have now sufficient info
[16:26:13] <wfq> by the way transactions is just something a sort of recent in MOngo, right?
[16:26:22] <Derick> yes, MongoDB 4.0
[16:26:51] <wfq> beautiful though: https://www.mongodb.com/transactions
[16:28:41] <Derick> i hadn't seen that yet
[16:29:05] <wfq> It seems very intuitive
[16:29:27] <Derick> there are some gotchas with the API, but we're working on that for the drivers
[16:50:58] <wfq> Derick, thanks. In my next personal project I'll work with pymongo directly. I like sitting on the driving seat :)
[16:53:15] <Derick> :-)
[22:11:01] <binarylegit> Hello, We are using MongoDB 3.4, We have an external service attempting to connect directly to a secondary, but it appears that it must first auth to the primary in order to run any queries. Is that documented anywhere? or am I misunderstanding something?