PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 24th of May, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[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:03:25] <mick27> cores*
[00:03:54] <kurushiyama> mick27: Actually, as a rule of thumb: less cores, higher clock speed is what you want.
[00:04:21] <mick27> ok, thanks
[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,
[08:53:07] <telnes> http://pastebin.com/TriTJ4KR
[08:53:51] <telnes> is it best to duplicate entry for speed or is it best to separeted some filed and link on other collection ?
[08:55:42] <Ange7> Hey all
[08:56:15] <Ange7> just one question : Create index is necessary to aggregate faster ? or index is only for $match ?
[09:00:05] <telnes> Ange7: https://docs.mongodb.com/manual/indexes/
[09:04:01] <kurushiyama> Ange7: Indices in aggregations are only utilized in an early match
[09:05:34] <kurushiyama> telnes: Depends on your use cases. However, I would probably model it totally different
[09:05:59] <telnes> show me :D
[09:07:08] <kurushiyama> telnes: Sure. what is "mktime" supposed to be?
[09:07:27] <telnes> time
[09:07:36] <telnes> but in msec
[09:07:39] <kurushiyama> telnes: when the scan was made?
[09:07:46] <telnes> yes
[09:08:45] <telnes> I am pretty new in mongo
[09:08:52] <telnes> I test the power
[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:11:00] <telnes> ok
[09:14:09] <telnes> a mix of http://pastebin.com/JMLKTbCn
[09:20:30] <kurushiyama> telnes: http://pastebin.com/LpfEVyzA
[09:21:10] <telnes> I check
[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:25:14] <telnes> interresting
[09:25:22] <telnes> thanks
[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.
[11:30:48] <cheeser> just set permissions
[11:30:49] <kurushiyama> iirc... ;)
[12:21:23] <tantamount> How do I set user permissions on a database that does not exist?
[12:21:37] <tantamount> (yet)
[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...
[12:22:10] <tantamount> ping cheeser
[12:22:17] <seiren> :1
[12:35:04] <jokke> hi
[12:35:44] <jokke> i'd need to be able to see mongo databases from command line. --eval 'show dbs' doesn't work
[12:36:21] <jokke> any other ways to do this?
[12:38:12] <jokke> ah ok
[12:38:16] <jokke> found it
[12:38:17] <jokke> db.adminCommand( { listDatabases: 1 } )
[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:18:29] <rkgarcia> Koganei, enum type?
[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:42:12] <GothAlice> rkgarcia / Koganei ^
[15:42:31] <GothAlice> {type: {$in: ['A', 'B', 'C']}} — validation document for that
[15:43:12] <Koganei> ooh okay thanks
[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" ?
[15:44:57] <GothAlice> Sure can. {$or: [{type: 'A', X: {$exists: 1}}, {type: 'B', Y: {$exists: 1}}]}
[15:45:05] <Koganei> okay awesome
[15:45:12] <Koganei> thanks :D
[15:45:16] <Koganei> that's super helpful
[15:45:25] <GothAlice> Document validation is epically awesome.
[15:46:02] <Koganei> yeah looks really powerful
[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:08:59] <Koganei> okay I see!
[16:09:33] <Koganei> so there's no way to make sure that foo is actually an array and not just a number?
[16:10:07] <GothAlice> No.
[16:11:20] <Koganei> kk thanks
[16:18:18] <rkgarcia> thanks GothAlice
[16:18:40] <GothAlice> It never hurts to help.
[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
[16:23:18] <GothAlice> used to. ;)
[16:23:35] <GothAlice> Rather, the former takes time, or the latter takes time. Take your pick. XD
[16:24:05] <rkgarcia> XD
[16:24:46] <GothAlice> Really unfortunate to not be able to see the end of the line you're typing…
[16:26:41] <rkgarcia> GothAlice, document validation it's new in 3.2 ?
[16:27:03] <GothAlice> Says at the very top of the documentation page, just below the contents listing on most pages.
[16:27:47] <rkgarcia> yeah new in 3.2 :O
[17:34:07] <Industrial> Hi.
[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:43:46] <cheeser> (bad idea_
[19:44:21] <tombin> kurushiyama; yes
[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:44:46] <kurushiyama> tombin: ^
[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:46:57] <tombin> oh really ?
[19:47:03] <cheeser> yep
[19:47:07] <tombin> i did not know that
[19:47:28] <tombin> mongodb://user:passwowrd@mongs01,mongos02?ssl=true ?
[19:47:28] <kurushiyama> So, remove the LB and you should be good to go.
[19:47:36] <tombin> something like that ?
[19:48:00] <tombin> so then i should get a ssl cert for each individual host then
[19:48:13] <cheeser> or use the same for each
[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
[19:51:02] <tombin> thanks guys !
[19:51:06] <tombin> big help
[19:51:09] <cheeser> any time
[19:51:23] <kurushiyama> cheeser: Regarding stickies: Some loadblancers do stickies by source IP.
[19:51:38] <cheeser> true
[19:51:54] <cheeser> we get lots of issues around people use LBs so i'm going to guess that most aren't configured/capable
[19:52:14] <kurushiyama> delegate does so by default, iirc. Not sure about HAProxy.
[19:55:21] <kurushiyama> Oh F..lying Spaghetti Monster. delegate seems to be discontinued... :(((
[19:55:57] <cheeser> it's not. it's just ... letting something else do the actual work.
[19:56:19] <kurushiyama> cheeser: Huh? delegate.org ?
[19:57:03] <cheeser> a bad joke
[19:57:30] <kurushiyama> Yeah, German sense of humour, sorry.
[19:58:27] <kurushiyama> :(((
[19:58:44] <kurushiyama> Thats really bad news for me.
[19:59:15] <cheeser> fork it!
[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
[20:26:07] <deniz946> http://pastebin.com/3ZA7ALWS
[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.
[22:18:33] <kenalex> hello ladies and gentlemen
[22:41:33] <rkgarcia> hello kenalex