[00:02:57] <mick27> kurushiyama: last one, could the number of core play a role here ? I don't see anything configured on that part, but the newer machine will have less core (because the old one was oversized big time)
[00:04:43] <kurushiyama> mick27: However, this is a rule of thumb only.
[07:49:30] <tantamount> How do I create a database with no collections in order to set permissions on the database object?
[07:51:24] <tantamount> For that matter, does the database need to exist in order to set permissions on it?
[08:03:09] <TheTank111> has anyone experienced a bug where findOneAndUpdate() is not actually atomic? I have some code for my node server which checks the returned result against the expected and they differ because it is not being updated atomically
[08:53:00] <telnes> helloI have a design db question,
[09:09:44] <kurushiyama> telnes: First advice: Always use ISODate() for datetime values. It has a resolution of milliseconds, which should be enough for most practical purposes.
[09:21:50] <kurushiyama> If your scans are async and may come in at various times, you can add a field to the array instead of grouping by date in the aggregation.
[09:25:09] <telnes> kurushiyama: i didn't know aggregate
[09:27:40] <kurushiyama> telnes: It is a poor example for aggregation ;) But in general, with time series data, you want to be as flat as possible. With this data model, you can have coroutines/goroutines/threads do the actual check and write their results into the database immediately and you spare an update operation. What you may want to use instead of using a datetime to identify a scan is to use some sort of UUID, by which you can group the w
[09:27:40] <kurushiyama> hole scan, or scan by IP, or whatnot.
[10:51:18] <Zelest> Derick, How am I supposed to create dates with the new mongodb driver? is new MongoDB\BSON\UTCDateTime(time()*1000) the correct way to go? :o
[10:54:30] <Zelest> Ah, found http://mongodb.github.io/mongo-php-library/tutorial/bson/#persistable-classes
[10:54:42] <Zelest> So in short, yeah, that's the right way.. :)
[11:06:27] <tantamount> How do I create a database with no collections in order to set permissions on the database object?
[11:30:34] <kurushiyama> tantamount: You do not need to.
[12:21:42] <seiren> Hello. I'm having issues with mLab and NodeJS. I insert data into the mLab database and the data disappears about 5 or 10 seconds later. I;m using the standard mongodb driver for nodejs and the mLab replica set URL to connect. I have a Parse app connected to the same database too. That seems to work fine...
[13:23:29] <GothAlice> tantamount: You create it. Any operation that applies a setting to a collection or database will create that collection or database, respectively.
[13:25:35] <GothAlice> tantamount: https://docs.mongodb.com/manual/reference/method/db.createCollection/ is a typical way to create a collection explicitly, but no such explicit creation is needed for databases. https://docs.mongodb.com/manual/reference/method/db.createUser/#db.createUser would create the database namespace if it didn't previously exist.
[13:26:08] <GothAlice> (It's not needed for collections, either, as just inserting will create it. But often it can be useful to be explicit. Explicit > implicit.)
[15:11:25] <Koganei> hi all, if I have a field that can only be one of three strings, how do i set up my validation to make sure it's only one of those? like { type: 'A' }, { type: 'B' } or { type: 'C' }
[15:19:58] <rkgarcia> Koganei, you need validation in your app
[15:22:11] <Koganei> oh okay I didn't realize string types could use enum
[15:22:13] <Koganei> I found this http://mongoosejs.com/docs/api.html#schema_string_SchemaString-enum
[15:22:32] <Koganei> does it only apply to mongoose library or is that something that mongo can use internally?
[15:42:08] <GothAlice> ... MongoDB can totally do any schema-like thing you'd want natively, saving you from situations where operations in, say, a mongo shell can bypass application-level validation. Modern MongoDB use really, really doesn't need a DAO / ODM layer. Ref: https://docs.mongodb.com/manual/core/document-validation/
[15:43:13] <GothAlice> (There's also the fact that through $and/$or use, plus all of the various other query operators, that document validation is also infinitely more powerful than application-level schemas.)
[15:43:55] <GothAlice> That's also ignoring the Mongoose issue. ;P
[15:44:15] <Koganei> I have a follow up question though, can I say "if type is A, then expect a sibling field called X, if type is B then expect a sibling field called Y" ?
[16:07:01] <Koganei> @GothAlice one more question :x how do I validate an array of integers? I'm having a lot of trouble googling for answers to these questions
[16:07:35] <GothAlice> Koganei: The Document Validation documentation page explicitly mentions what happens when you attempt to validate an array field; the validation in the validation document is applied to each element.
[16:07:54] <GothAlice> For example, if "foo" is an array field: {foo: {$type: 'number'}} — this will validate that each element of the array is a number.
[16:08:09] <GothAlice> (Number being an alias for all of the different integer types + float.)
[16:23:17] <GothAlice> rkgarcia: The "is it really an array, or just a single value of the same type" problem does not typically happen in reality. The value can only ever be what you $set it to (or use another atomic operation against), and all of the array updates ($push, etc.) a) verify it's actually an array first, or, b) if the field doesn't exist, create it as an array. Sometimes getting used to values being intentionally missing can take some getting
[17:34:12] <Industrial> `mongodump --db test --collection postalcodes --out .` gives me an empty test directory
[17:34:21] <Industrial> I know that collection contains a lot of entries/docs
[17:34:29] <Industrial> am I doing something wrong?
[19:02:32] <tombin> when upgrading to ssl on a sharded cluster (2 query routers, 3 config servers, 2 shard servers), does the certificate on the query routers serve the load balancer address and certificate on config and shard servers serve their respective hostnames ?
[19:02:36] <tombin> or does the certificate on every host need to match the hsotname ?
[19:08:18] <Industrial> `mongodump --db test --collection postalcodes --out .` gives me an empty test directory
[19:08:23] <Industrial> I know that collection contains a lot of entries/docs
[19:08:25] <Industrial> am I doing something wrong?
[19:43:28] <kurushiyama> tombin: You have an LB in front of the MongoS?
[19:44:41] <kurushiyama> cheeser: I am actually not too sure wether it is an outright bad idea. What I am pretty sure of that it does not serve any reasonable purpose.
[19:45:05] <cheeser> it is generally a bad idea because of how cursors are handled.
[19:45:06] <tombin> kurushiyama; so i have a cert for the vip address on that lb
[19:45:28] <kurushiyama> cheeser: Right, it would have to be sticky.
[19:45:33] <tombin> kurushiyama; but wondering if thats ok for the mongos hosts, and then i get a cert for all the mongod's
[19:45:58] <cheeser> kurushiyama: exactly. and they generally aren't because most aren't mongodb wire protocol aware.
[19:46:42] <kurushiyama> tombin: First of all, as cheeser pointed out, it is not really a good idea to have an LB in front of MongoS. And it definetly serves no purpose, since you can add multiple mongos in your connection string.
[19:48:35] <kurushiyama> tombin: I _think_ you need the user:pass combination for all mongos instances, but I am not too sure about that, since I always run sharded clusters in private networks.
[19:48:55] <cheeser> if there's a different user/pass combo for each mongos, you've messed up.
[19:49:02] <kurushiyama> tombin: Yes, should do the trick.
[19:49:33] <tombin> each mongos has the same user/pass
[19:49:51] <tombin> thats should be stroed on config
[20:02:50] <GothAlice> As an alternative, if your application has some session identifier, you can often pin by that. (We pin by our session cookie at work.)
[20:03:05] <kurushiyama> It wasn't on github or any other platform. Source was on the Japanese AIST website. Because of legal reasons. When I am lucky, an old source version may be on EPEL, if I am lucky.
[20:03:30] <kurushiyama> The thing is that you could do some black magic with it, because you could basically create pipelines.
[20:05:35] <kurushiyama> I once did the following with it: accepted UDP syslog packages, forwareded them to the actual syslog server, copied them into a pipeline, made TCP packages from them, send them through an SSL tunnel and did the reverse on the recipients side. It was necessary this way because of company policies. Ugly, but we were able to make it work quite easily.
[20:07:53] <kurushiyama> And one could configure it to be a varnish on steroids. :( And now I have to check with the AIST wether it is ok to still use it and whatnot.
[20:09:04] <kurushiyama> Well lamented enough. Improvise, adapt, overcome.
[20:13:11] <GothAlice> All shiny and chrome, riding to Valhalla, kurushiyama? ;) cheeser: Nothing wrong with having lots of mongos as long as they all see the same config server, right?
[20:13:33] <cheeser> GothAlice: i've known shops to have dozens of mongoses.
[20:13:40] <GothAlice> I.e. my plan to run one per app worker isn't too pants-on-head.
[20:13:41] <cheeser> which is probably overkill but hey
[20:13:54] <cheeser> no, i think that's common. if unnecessary
[20:14:16] <GothAlice> Simplifies the deploy process a bit to keep them homogenous and compact (that is, fewer moving VM parts).
[20:15:25] <kurushiyama> More of rusty and maroon, GothAlice ;P
[20:26:00] <deniz946> Hello, how i can save a single object into some variable in my scema with mongoose?
[20:26:06] <deniz946> for example in my user variable
[21:24:04] <GothAlice> Working on my pymongo query planner; is there any edge case I'm not thinking of for automatic simplification of the {$and: […]} case? (Simplification being un-wrapping and dictionary merge, with unsatisfiable exclusive conflicts being error-worthy.)
[21:25:03] <GothAlice> Deep merge, that is. {$and: [{foo: {$gt: 27}}, {foo: {$lt: 42}}]} → {foo: {$gt: 27, $lt: 42}}
[21:25:51] <GothAlice> Whereas a result like {foo: {$gt: 42, $lt 27}} is an error due to non-sensical-ness.