PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 8th of September, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[03:50:26] <AmazeCPK> can a collection store different data values for each element? ex: element 1 will have name, lastname. element 2 will store name, lastname, email
[04:38:05] <Boomtime> @AmazeCPK: MongoDB does not enforce any schema, you can store different elements per document, or different data types per element per document, MongoDB doesn't care
[04:41:25] <GothAlice> Boomtime: You are both correct and incorrect. ;P
[04:41:28] <GothAlice> https://docs.mongodb.com/manual/core/document-validation/
[04:42:21] <Boomtime> sure, unless you have document validation on, or have a special unique index
[04:42:53] <Boomtime> note the question was "can a collection.. " to which the answer is "yes"
[04:43:29] <GothAlice> Potentially subtle distinction between "MongoDB doesn't care" and "MongoDB does actually care sometimes", I guess. ;)
[04:44:25] <Boomtime> sure, fair enough
[04:44:41] <Boomtime> 'can be made to care' is certainly true
[04:46:12] <GothAlice> More importantly, AmazeCPK, there's generally no particular reason to do that. One is free to vary fields, not just the types of fields, per-document. I.e. some records just not having an e-mail address is better than having a pseudo-anonymous field like "field2" to store name OR last name OR email, etc.
[04:46:31] <GothAlice> Sparse can be better than dense. ;)
[05:13:11] <spacecrab> GothAlice: i built my first replica set lol
[05:21:58] <AmazeCPK> thanks for the responses :)
[06:44:34] <hemangpatel> Hello there!!
[06:45:26] <hemangpatel> I have CIDR block in collection. Is there any way to check that given IP is in collection ?
[07:38:14] <sabrehagen> what are the reasons for not running mongodb as root?
[08:00:58] <jelle> sabrehagen: doesn't need root privs
[08:01:17] <jelle> sabrehagen: and it's positive for security
[08:01:39] <sabrehagen> jelle: what ways can security be exploited when running as root?
[08:01:56] <jelle> sabrehagen: well if mongodb runs as root and you exploit mongodb => your root
[13:24:56] <jokke> hey
[13:25:50] <jokke> i have a fairly complex aggregation of which i'm not sure if there's a better way to do it
[13:26:14] <jokke> maybe you guys could take a look and tell me what you think
[13:26:42] <jokke> https://p.jreinert.com/olP/
[14:02:17] <LowWalker> So is there any extra option required to pass to the config file that allows starting of replSet, I'm seeing this type of error if anyone can help https://gist.github.com/lowwalker/6557c8dc56331f719401b20ae2b8062b
[14:04:01] <Derick> 2016-09-08T12:33:14.305+0000 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
[14:04:10] <Derick> Mongo is already running ...
[14:10:05] <LowWalker> Running my automation again, I'll see where the service state is before I try a restart. I thought I could start it, add users, add a new cfg and then restart without issue
[14:10:36] <Derick> LowWalker: the restart apparently didn't stop it first
[14:12:24] <LowWalker> Correct, I'm using ansible and I just tried to have it explicitely stop and it didn't
[14:12:36] <LowWalker> So that looks like the thing to fix :)
[15:30:21] <jokke> anyone?
[15:30:45] <Derick> jokke: You're on IRC, just ask the question :)
[15:30:52] <jokke> i did
[15:30:58] <Derick> oh!
[15:31:02] <jokke> :)
[15:31:23] <Derick> why do you do the unwind twice?
[15:31:51] <jokke> yeahhh... well the field is an array
[15:32:01] <jokke> so in the first group i create nested arrays
[15:32:16] <Derick> this is too mindboggling for me :)
[15:32:31] <jokke> :D you're not alone :D my brain is toast...
[15:32:43] <Derick> it be nice to visualize this...
[15:33:10] <jokke> yes, totally. I'll do that at some point for documentation purposes
[16:44:34] <Toba> So.. I've tried to find info on this and have come up short in my googling. What were the problems with bindata subtype 3 (legacy uuid) that inspired the creation of subtype 4?
[16:44:44] <Toba> Does anyone know what the issue was that the new format was meant to resolve?
[16:44:52] <Toba> I just see vague statements about "problems"
[16:45:23] <Derick> it had to do with not specifying length IIRC
[16:45:45] <Toba> Do you know if there is an article/post that explains the problem?
[16:46:19] <Derick> not sure
[16:46:22] <Derick> I can check some code
[16:46:50] <Toba> I would really appreciate it Derick
[16:46:59] <Toba> it's really burning up dev time on my team right now... :(
[16:47:17] <Toba> also, does anyone know how indexes deal with a mix of both?
[16:47:34] <Toba> if something was saved as subtype 3, and hten you try to query it and pass in a subtype 4 value in the query, or vice versa
[16:47:37] <Toba> does it work? or does it not match.
[16:48:07] <GothAlice> Derick: When you bind a Document class to a collection in marrow.mongo, it switches the uuid_representation to STANDARD, vs. the legacy version the Python driver defaults to. I've been curious if this is wise or not, as the Pymongo docs describe it "changing some time in the future".
[16:48:10] <Derick> https://jira.mongodb.org/browse/SERVER-12835 lists "Subtype 4 should be used, and we should ensure that the generated UUID is compliant with RFC 4122."
[16:48:22] <Derick> GothAlice: I have not heard of "marrow"
[16:48:40] <Toba> I assume that refers to the "if no serialization specified, then this is how you serialize a uuid" part of RFC 4122
[16:48:41] <GothAlice> Derick: https://github.com/marrow ;P
[16:48:45] <Derick> Toba: the equality test will fail I believe
[16:49:04] <Toba> that's kind of what I was afraid of
[16:49:11] <Toba> since it's not a native bson type, but just BinData.
[16:49:58] <Derick> can't find it, I'll ask
[16:52:01] <GothAlice> https://github.com/mongodb/mongo/blob/419a2e4eaf791a8d217050dbf0ca63149f261e0f/src/mongo/db/matcher/expression_algo.cpp#L106-L110
[16:53:30] <GothAlice> ¬_¬ This is a bit deeper than I've explored before.
[16:54:43] <Derick> Toba: https://jira.mongodb.org/browse/JAVA-403
[16:55:00] <Derick> it had to do with Java/python incompatibility
[16:55:29] <GothAlice> Ouuuuuch.
[16:57:12] <Toba> Yeah that's what's biting us.
[16:57:15] <Toba> Java/python incompatibility
[16:57:31] <Toba> so python was doing it right and java was doing it wrong?
[16:57:47] <Toba> and subtype 4 was created do make it unambiguous?
[16:57:50] <cheeser> the other way around ;)
[16:58:02] <Toba> odd that the bug is in the java driver then
[16:58:20] <GothAlice> Endianness is open to opinion. ;P
[16:58:32] <cheeser> all the drivers had to update to the new type so i'm sure there were issues in the other drivers, too.
[16:58:35] <GothAlice> https://github.com/marrow/mongo/blob/develop/marrow/mongo/core/document.py?ts=4#L97-L107 < you might want to do something like this to mutate the CodecOptions for the collection you're using.
[16:58:48] <GothAlice> As the default hasn't been updated, and there's no particular estimate of when it'll happen.
[16:59:21] <Derick> Toba: cheeser is biased ;-
[16:59:21] <Toba> GothAlice: endianness within one system is open to opinion, when you are a network service you have to decide hwich one is used
[16:59:31] <Toba> that's what Network Byte order was for
[16:59:33] <Toba> right
[16:59:34] <GothAlice> Toba: Thus subtype 4.
[16:59:38] <cheeser> i'm not biased. i'm right. ;)
[16:59:48] <Toba> Yeah, because the horse had already left the barn by the time the issue was raised
[17:00:04] <Toba> and doing subtype 4 was done to make it unambiguous so you'd know "oh if everything is subtype 4 we're ok"
[17:00:13] <Toba> yea?
[17:00:20] <GothAlice> By the looks of it, quite so.
[17:00:26] <Toba> Bollocks.
[17:00:32] <Toba> That is somewhat upsetting.
[17:00:41] <Toba> But at least I know what/why now. Thanks y'all.
[17:00:49] <cheeser> are you seeing type 3 in the wild?
[17:02:59] <GothAlice> cheeser: https://github.com/mongodb/mongo-python-driver/blob/master/bson/codec_options.py#L41-L69 < PYTHON_LEGACY == OLD_UUID_SUBTYPE == 3
[17:03:14] <GothAlice> It's the default. For some reason. Likely backwards compatibility. ;P
[17:03:19] <Toba> the default is still 3 on basically everything, cheeser
[17:03:19] <Toba> so
[17:03:20] <Toba> uh, yeah
[17:03:33] <cheeser> GothAlice: ahhhhhh
[17:03:36] <Toba> even the mongo shell is still 3
[19:12:46] <n1colas> Hello
[23:46:57] <zacharypch> hi, i'm trying to set up a replicaset with machines in three different locations. trying to use ssh tunnels as my means of doing it. so on the "primary" node, i'm starting forwards and reverse tunnels to the two secondaries, and on one secondary i'm starting forward and reverse tunnels to the other secondary. the hostnames in the rs.conf() seem problematic though because everything needs to be localhost, and the ports won't
[23:46:58] <zacharypch> match. so there must be a better way?
[23:52:54] <GothAlice> zacharypch: SSH is a poor performer in terms of throughput, and adds another "moving part" to fail in a setup.
[23:53:55] <GothAlice> zacharypch: Instead, enable SSL communication, node authentication, and allow them to connect to each-other directly. Since SSL is the basis for many VPNs (OpenVPN, for example), this method can be quite secure, especially with firewall rules controlling who is allowed to connect from where as an additional layer.
[23:54:03] <GothAlice> A "full enterprise solution" would also involve IPSec.
[23:58:58] <zacharypch> thanks GothAlice, for "node authentication", that's authentication between the members, like here: https://docs.mongodb.com/manual/core/security-internal-authentication/#inter-process-auth ?