[04:02:00] <Mrgoose> Hey quick question, I have a bunch of sensor data thats collected every 3 seconds. WIth mongodb could i create aggregate queries that would show the average every minute?
[04:07:21] <Ameo> Mrgoose: you can just select all data from the past minute, add up the results, and divide by the number of results returned :p
[05:40:39] <Mrgoose> im currently watching https://www.mongodb.com/presentations/mongodb-time-series-data
[05:42:33] <kurushiyama> Mrgoose: Well, good entry point. Do not get me wrong: MongoDB might well fit your use case, but if you have the time, I'd probably checl InfluxDB, too.
[05:47:23] <kurushiyama> Mrgoose: From a very high level perspective, it is less flexible and very much less general purpose. The whole TICK stack combined, however, makes it very easy to get results. So you really have to decide. You can not use InfluxDB for anything else, basically.
[05:48:05] <Mrgoose> well my application is strictly for time series data, analytics
[05:48:31] <Mrgoose> just from what im looking at a quick glance , influxdb seems to be easier to get that done
[05:49:14] <kurushiyama> Mrgoose: I would not ditch MongoDB that easy.
[05:49:37] <kurushiyama> Mrgoose: It is _much_ better t dealing with _a lot_ of datapoints.
[05:54:11] <kurushiyama> Mrgoose: If you have the time, I'd simply check both
[05:54:23] <Mrgoose> yea, that's likely what i will do
[05:54:56] <Mrgoose> i will say the querying looks a lot easier in influxdb
[05:55:57] <kurushiyama> Mrgoose: The querying? Not so much,imho. Personally, I find the aggregations easier, but then, I use MongoDB for much longer.
[06:03:47] <kurushiyama> A major drawback I see is that you almost always need another database for well, everything else like authentication and whatnot. I code in Go, so there is always boltdb embeddable, but it is a pita. With MongoDB, you only have one persistence technology.
[06:04:21] <kurushiyama> (well, not boltdb is a pita, but dealing with multiple datasources is).
[09:11:59] <Ruphin> Anyone here? I have an issue with a node failing to rejoin a replica set. More specifically, the HostnameCanonicalizationWorker fails to resolve the hostname in the replica set config so it does not recognise itself as a member
[12:46:53] <Onemorenickname> there is the syntax db.Post.find({}, {}, {limit:10}, cb), but I'd like db.Post.find({}).limit(nb)
[12:47:22] <Onemorenickname> dddh_, this is synchronous, isnt it ?
[12:56:52] <dddh_> Onemorenickname: using some framework like Mongoose?
[12:57:16] <Onemorenickname> dddh_, shall I deduce that it cant be done ? D:
[13:13:05] <kurushiyama> Onemorenickname: It depends. First, you should probably state what stack you are using instead of making us guess.
[13:15:00] <tembrae> Hello, I have a question. I have a mongo db with replication enabled and 2 full disks. I am wondering how to reduce the amount of storage used as a temporary solution untill we can upgrade disk space
[13:18:52] <tembrae> kurushiyama: unfortunately not
[13:21:56] <kurushiyama> tembrae: Well, you _could_ use --repair.
[13:22:04] <kurushiyama> tembrae: Be warned, however.
[13:23:55] <kurushiyama> tembrae: the other option would be to wipe dbpath , install the new hard disk, setup LVM and do a resync. You should only do this, however, when you are sure your current primary holds.
[13:24:07] <tembrae> kurushiyama: yes I have read about the repair and compact options but they do not seem like viable stategies
[13:24:56] <tembrae> kurushiyama: our primary is full too so that's not an option either
[13:25:33] <kurushiyama> tembrae: Well, another option of course would be to build an LVM besides it, copy the data over and use it
[13:29:48] <tembrae> kurushiyama: If you add a second server (with double the disk space) and add that as a replication set, how will this affect the existing replication?
[13:35:28] <kurushiyama> Since most likely your nodes are down because of the full disks, most likely not at all.
[13:44:45] <Ange7> i try to find how to insert document if not _id exists else ignore is it possible ?
[13:46:43] <kurushiyama> tembrae: Ok, give the new server the IP of one of the old ones, CREATE AN LVM ;), copy over the data and config, fire up an MongoDB.
[13:52:16] <yopp> kurushiyama, re last time, I've played with value keys, and everything is just fine, but I'm trying to follow the array approach as you advised.
[13:55:46] <yopp> I'm looking right now on the another project, where we did exactly that
[13:57:34] <kurushiyama> yopp: As said: you must do as you are pleased, but how an index of a fraction of the data should be bigger than the data itself eludes my comprehension, and I am not exactly a beginner.
[14:02:20] <yopp> kurushiyama, when you have small records, like around 64 bytes, even with primary index on _id you will have overhead of _id + reference to the page, which is already something like 24 bytes. Add timestamp index, and here you are : your data set is smaller than index size
[14:03:50] <kurushiyama> yopp: uhm... you are aware that ts are stored as int64?
[14:04:45] <kurushiyama> yopp: And objectIds, should you choose to use them, are internally stored as 12 bytes.
[14:07:39] <yopp> you are not just storing ids, you are storing the tree of references to the storage
[14:10:22] <kurushiyama> yopp: Well... what? Ok, you made up your mind, be it. But modelling data for constraints other then CRUD efficiency will impact said efficiency. And working against best practises (have a look at how dedicated TS databases handle it) should tell you something. But, be it, do as you please.
[14:15:55] <Ange7> i try to find how to insert document if not _id exists else ignore is it possible ?
[14:16:46] <cheeser> an update with only $setOnInsert ?
[14:19:30] <jokke> i want to setup a sharded cluster with docker and i'd need to be able to call rs.initiate and sh.addShard in a way that it's run only once
[14:21:05] <Ange7> cheeser: is it possible to define update with only setOnInsert ?
[14:21:36] <kurushiyama> jokke: I would not do that. Use a docker container for MongoDB. then fire up the cluster via shell. You can script that, of course, but thing can too easily go south that way.
[14:22:33] <yopp> cheeser, say I have a document: {_id: oid, events: [{_id: 1, a: DateTime, b: DateTime} ] }. Is there any way to tell $addToSet to check for just "events._id" for uniqueness? Say I'm doing "$addToSet": { _id: 1, a: { DateTime + 1} } .
[14:22:41] <kurushiyama> Ange7: What is wrong with https://docs.mongodb.org/manual/reference/operator/update/setOnInsert/ ?
[14:27:33] <kurushiyama> jokke: And usually, MongoDB is not as volatile. It might be worth if you compose services (which you rarely do, since more often than not, you do not want to have much more than MongoDB running on a production server)
[15:08:59] <varunkvv> I ran into a crazy issue over the weekend. One of our applications was performing a query that hit the caveat: https://docs.mongodb.org/manual/core/index-intersection/#index-intersection-and-sort - this was on a large resulting dataset and the application side kept retrying after a timeout. This actually caused the mongodb server to crash with an "out of memory" error. Kind of a first for me.
[15:52:19] <jokke> you might also want to do regional sharding or sth like that
[15:52:46] <StephenLynx> and what makes it distribute over shards?
[15:56:01] <StephenLynx> ok, so from what I read https://docs.mongodb.org/manual/core/sharding-shard-key/ _id is good IF you use it hashed for sharding?
[16:44:24] <varunkvv> kurushiyama, replying to this: http://irclogger.com/.mongodb/2016-04-25#1461596482, we're _not_ using swap on the servers, but is that a mistake for WiredTiger? I know it was not a requirement for mmapv1.
[16:45:00] <kurushiyama> varunkvv: It always was a requirement to prevent Linux OOM-Killer from kicking in
[16:50:58] <varunkvv> Yeah, it's something to consider and try out. This is the first time I've had OOM killer hit mongo though :). Thanks for the pointer.
[18:29:28] <kurushiyama> ams_: Uhm, could you go into more detail?
[18:30:36] <ams_> kurushiyama: I'm trying to create a replicaset, but mongodb isn't happy (I think!) that the hostname I'm giving it doesn't resolve to 127.0.0.1
[18:31:20] <ams_> So I'm trying to work around that with HOSTALIASES
[18:31:21] <kurushiyama> ams_: And how should the other servers reach somthing that actually resolves to 127.0.0.1? ;)
[18:31:39] <ams_> The problem is that it *doesn't* resolve to 127.0.0.1
[18:32:00] <ams_> It resolves to a service that the host and all other hosts can access
[18:32:17] <kurushiyama> ams_: If all replica set members get the config that they should contact the other members on 127.0.0.1, what would happen?
[18:33:02] <saml> ams_, what's your replicaset config?
[18:33:06] <kurushiyama> ams_: To put it another way: do not use the loopback interface to create a replica set, unless it is local only.
[18:33:20] <saml> make sure hosts listed in the config can be resolved from each member.
[18:34:25] <ams_> kurushiyama: I think you're misunderstanding me. I understand what a 127.0.0.1 is, I'm not trying to get different hosts to access different 127.0.0.1s
[18:35:20] <Derick> it needs to always resolve to the same IP address (and not 127.0.0.1)
[18:35:59] <saml> could you copy paste new config you want to use?
[18:36:07] <ams_> That is the config I want to use, sorry
[18:36:14] <ams_> at the mo it's "localhost:27017"
[18:36:33] <ams_> Derick: maybe I've misunderstood then. What causes that error ^ though? I don't have an interface on this server bound to 191.168.0.10. But traffic for that IP will be routed to that server.
[18:36:47] <ams_> (The reason for the contrived network set up is i'm trying to get this working in kubernetes/docker)
[18:37:00] <saml> what's output of command host mongodba.infra.svc.cluster.local
[18:37:29] <saml> did you start your mongod with rs config?
[18:45:57] <Ryzzan> i want to $push to an array inside an array... let's say... {_id : Number, array : [{someProperty : String, anotherArray:[]}]}
[18:46:05] <ams_> sam1: ^ and I'm connecting `mongo 127.0.0.1`
[18:46:07] <Ryzzan> how to push to "anotherArray"?
[18:46:55] <saml> so you have replicaset already configured. maybe unconfigure replicaset (i don't know how to do this). and reconfigure with the hostname, not localhost
[18:47:22] <ams_> sam1: yeah i've tried that, same error. I don't see why that should have any impact?
[18:47:58] <saml> ams_, output of mongo mongodba.infra.svc.cluster.local
[18:49:03] <ams_> sam1: oooh! i'm wrong, that IP isn't working from this container... interesting
[18:49:07] <ams_> Ok, thanks, that's clearly my issue
[18:50:46] <Ryzzan> saml: ty... think i did it already, but let me check if I misstyped something... ;)
[18:59:55] <Ryzzan> saml: the _id would be enough to find the place to push the value... cause "anotherArray" is directly connected to "array"... got it?
[20:50:43] <WiuEmPe> StephenLynx, yes, i restore this with mongorestore, thanks ;)
[20:56:31] <kurushiyama> WiuEmPe: It does not sound like a good idea to do a restore as the first task with MongoDB. Feel free to ask if in _any_ doubt.
[20:59:57] <WiuEmPe> kurushiyama, ;) thanks for help
[21:00:39] <kurushiyama> WiuEmPe: Well, StephenLynx helped you, I am just offering to help in case you need further assistance.
[21:00:45] <WiuEmPe> developer asks about user and password. This should be in backup?
[21:13:23] <kurushiyama> assert: Learning something new. Always, on any topic, every day. Now I am _really_ puzzled what the authSource / authenticationDatabase params are there for...
[21:18:24] <WiuEmPe> I like this... When noob ask for simple things, and hard users begining dispute ;)
[21:21:00] <kurushiyama> WiuEmPe: I have to admit that I only use authentication, and most of the time I simply stored system wide users in "admin", whereas I stored per DB users in the respective DB. Since I do my backups with LVM snapshots, I never noticed or had to know the exact position. However, for people doing backups with mongodump, this might make a huge difference.
[21:22:52] <WiuEmPe> kurushiyama, previous admin doing only backup data, dont thinks about system, LVM (what is lvm?!) and VM... And after crash both SSD we must setup system from nothing...
[21:23:42] <WiuEmPe> kurushiyama, I advise you use xfs and xfsdump - this is amazing!
[21:24:09] <kurushiyama> WiuEmPe: And I use xfs since... well, a long time ;)
[21:24:34] <WiuEmPe> kurushiyama, yes on servers setup by prevous admin i dont found any LVM, so i thinks that he dont hear about LVMs ;)
[21:24:58] <WiuEmPe> kurushiyama, so why not in mongo?
[21:26:04] <kurushiyama> WiuEmPe: LVM snapshots are suggested, and it does not make much difference for me. I guess this is because an LVM snapshot freezes the blockdev automagically.
[21:26:31] <WiuEmPe> kurushiyama, xfsdump doing this same
[21:28:35] <kurushiyama> WiuEmPe: Actually, I am not too sure about this. As per the xfs mailing list, xfsdump is not atomic.
[21:29:12] <kurushiyama> WiuEmPe: At least if we can trust Ian Rayner from SGI ;)
[21:29:22] <WiuEmPe> now i'm not sure about this ;)
[22:12:40] <GothAlice> Veeeeeeery interesting. Just had a pymongo app which lost all pool connections due to socket timeout go "full Balmer" with 140% CPU use doing nothing.
[22:14:57] <GothAlice> Go home, pymongo, you're drunk. XP