PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 27th of January, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:30:25] <Ricoshady> im trying to make a replica set, do I need to start the mongo process as a master in order to create a user? then convert to replica set?
[00:31:03] <Ricoshady> i had it set to master, but then I couldnt add the replica set, then changed it to a replica, then I couldnt create a user
[00:45:02] <GothAlice> Ricoshady: Have you read through https://docs.mongodb.org/v2.6/tutorial/deploy-replica-set-with-auth/ ?
[00:45:35] <GothAlice> Authentication needs to be configured first, with a shared key generated to let the secondaries communicate securely.
[00:45:55] <Ricoshady> got it! just what I needed
[00:46:22] <Ricoshady> so the base line config sets up a replica set with no auth, wide open
[00:47:03] <Ricoshady> can I assume if you don't use the --config option, that the only option mongo uses are from the command line?
[00:47:13] <joannac> correct
[00:47:25] <Ricoshady> ok cool
[00:47:35] <GothAlice> That document has step-by-step instructions. :)
[00:47:49] <Ricoshady> thanks guys!
[01:54:53] <rpdprd> according to https://github.com/mongodb/mongo/blob/master/src/mongo/bson/oid.h and my experimentation, the first 4 bytes with the timestamp is big endian as opposed to the little endian used everywhere else in bson. The source claims that the decision is because mongodb uses "memcmp to order OIDs". But what does that actually mean?
[01:55:29] <rpdprd> What if I (for shits and giggles) construct my own objectIds and put the timestamp in little endian? Would there be a performance penalty or something?
[01:56:13] <rpdprd> It says "we want to ensure an increasing order" but is that really important? What if I wasn't using ObjectId for _id but were using a string or something like that instead?
[01:58:17] <GothAlice> rpdprd: Because the memories are compared as strings, the order needs to be "natural" and not machine order. Like storing a filename prefixed with a date as 2016-01-20 instead of 01-20-2016 and expecting it to lexicographically sort.
[02:03:45] <rpdprd> GothAlice: I see. but are the _ids frequently compared?
[02:04:01] <GothAlice> Often; they're a shortcut for creation order.
[02:04:28] <rpdprd> ah I see. thanks
[02:46:14] <Waheedi> I'm using mongo cxx driver 2.4 in my c++ app, I have configured query.readPref(mongo::ReadPreference_Nearest, BSONArray()); to read from the nearest node I believe its not picking up the nearest node the nearest node ping is time=0.210 ms but the node its picking ping time is time=1.32 ms
[02:46:39] <Waheedi> Im sure its configurable some how to consider 0.210ms nearest than 1.32ms
[02:47:44] <joannac> Waheedi: https://docs.mongodb.org/manual/core/read-preference-mechanics/#replica-set-read-preference-behavior-nearest
[02:48:10] <Waheedi> secondaryAcceptableLatencyMS this guy here
[02:48:13] <Waheedi> thanks joannac
[02:48:21] <Waheedi> and localPingThresholdMs
[02:48:50] <Waheedi> joannac: is that for 2.4?
[02:50:09] <Waheedi> its localThreshold :)
[03:00:22] <Waheedi> is that only for mongos or does it work with mongod?
[03:00:32] <Waheedi> I'm using it for a replica set and not sharing
[03:01:26] <Waheedi> hmm
[03:01:36] <Waheedi> i think i know whats going on
[03:20:30] <Waheedi> thanks joannac :)
[04:12:50] <Waheedi> any example on --localThreshold?
[04:12:53] <Waheedi> for 2.4?
[04:14:22] <Waheedi> http://api.mongodb.org/csharp/current/html/P_MongoDB_Driver_MongoClientSettings_LocalThreshold.htm
[04:14:32] <Waheedi> :)
[04:32:01] <Waheedi> ok guys i just need a link for cxx-driver 2.4 api docs
[04:32:32] <Waheedi> i was able to find the cshapr one easy but not 2.4 cxx
[04:57:21] <Waheedi> candidate = _selectNode(nodes, tags->getCurrentTag(), false, localThresholdMillis,
[04:57:21] <Waheedi> lastHost, isPrimarySelected);
[05:01:21] <Waheedi> and what is this defaultLocalThresholdMillis?
[05:03:37] <Waheedi> ok http://api.mongodb.org/cplusplus/2.4.8 :)
[05:07:11] <Waheedi> I believe i need to use this function setLocalThresholdMillis with scoped_lock mutex
[05:19:47] <Waheedi> do i need to hard code this localThresholdMillis ?
[06:01:22] <Waheedi> I ended up lying to mongod :|
[06:44:10] <Waheedi> humongous
[07:07:26] <purezen> Hey, I am making an api which I need to perform a delete operation for me
[07:08:36] <purezen> I am using mongo as my persistence.. and the object on which I need to call delete on will have 1-many relat. with another object which will again have 1-to-many with another object
[07:09:27] <m3t4lukas> Waheedi: it's generally your choice what you hardcode :P The localThresholdMillis tells mongodb up to what ping length a node is considered local. The drivers do not necessarily need to be equal in functionality.
[07:09:45] <purezen> How do I efficiently perform a delete on the top-most object such that, all objects belonging to it will also be deleted?
[07:10:41] <Waheedi> :) m3t4lukas I ended up telling the client his connecting to localhost:27017 and using haproxy to pass back to mongod
[07:10:45] <joannac> purezen: code it up. you'll need a lot of loops
[07:10:49] <Waheedi> he's
[07:11:05] <m3t4lukas> purezen: traverse the tree and start deleting at the leaves or change your model so you embed the documents the are dependent on what you want to delete.
[07:11:59] <m3t4lukas> Waheedi: what for?
[07:12:12] <Waheedi> good question
[07:12:30] <m3t4lukas> uhum
[07:12:36] <Waheedi> so basically it seems there is this check here isLocalHost
[07:12:47] <m3t4lukas> just cut the proxy and connect directly
[07:13:24] <m3t4lukas> Waheedi: just give the mongo server a proper name
[07:17:27] <purezen> @joannac: yeah.. that is what I thought initially.. but that would result in a lot of api calls.. I need a more efficient solution.. since for a situation where 1-to-many is like A->B.. to delete an A object.. I would first need to get all Bs under A.. then call cascading delete on Bs and then delete the A.. all using Api calls.. which would crunch my server!
[07:17:41] <purezen> also my schema is like A->B->C
[07:18:02] <joannac> Then you picked the wrong schema for this use case :)
[07:19:19] <purezen> @m3t4lukas: hmm.. the problem with the efficiency that i just wrote would still persist.. also changing the schema is not an option :P
[07:19:53] <joannac> then take the performance hit
[07:20:06] <m3t4lukas> purezen: you don't need to change the schema for that.
[07:20:40] <m3t4lukas> purezen: sorry, I was confused with names
[07:21:01] <purezen> @m3t4lukas: np
[07:21:48] <m3t4lukas> purezen: you have those two options. You need to get away from thinking that calls are expensive. They are by far not as expensive as with SQL. Many API calls is quite normal for mongo to a certain degree.
[07:22:49] <m3t4lukas> purezen: API calls don't need to get interpreted first. They are pretty straightforward operations.
[07:24:05] <m3t4lukas> Derick, cheeser: are there any plans for the forseeable future for mongodb to be able to aggregate using OpenCL or CUDA?
[07:25:59] <m3t4lukas> Derick, cheeser: or at least parts of it. It may be needed to be able to save callable aggregations on the server first because of compute shader compilation efficiency and stuff.
[07:37:33] <Waheedi> m3t4lukas so what i was trying to do is that i have two clients on two different physical locations, talking to two(third is Arb) nodes in a replicaset that are also in two different physical locations.
[07:38:04] <Waheedi> Now client 1 and node1 are in the same physical machine
[07:38:51] <Waheedi> right now I'm using nearest read preference and I'm seeing that its going to node1 70% of the time
[07:39:06] <Waheedi> and thirty percent to node2 in the other physical location
[07:39:11] <m3t4lukas> Waheedi: yeah, that much I figured out. Just don't use localhost but the real DNS name of that machine or at least the machine name :P
[07:39:59] <m3t4lukas> Waheedi: nearest does not mean it connects to the nearest node in terms of distance but in terms of oing time
[07:40:07] <m3t4lukas> *ping
[07:40:33] <Waheedi> yeah ping time for the same physical machine is definitely less than the one somewhere else
[07:40:45] <m3t4lukas> Waheedi: that really depends
[07:40:51] <Waheedi> hmm
[07:41:10] <Waheedi> ping localhost and ping your neighbors public ip address
[07:41:11] <Waheedi> :)
[07:41:35] <m3t4lukas> Waheedi: on spikes you may have less ping on another machine or when your application introduces some heavy load on the system
[07:41:55] <Waheedi> yeah that might be true!
[07:41:58] <m3t4lukas> Waheedi: it does not use the real ping. It uses server response time. Sorry for confusing those two
[07:42:01] <Waheedi> you are right
[07:42:42] <m3t4lukas> Waheedi: if mongo uses the other server for 30% you can assume that it is best for you that it does that
[07:43:02] <Waheedi> this is what i did m3t4lukas :)
[07:43:08] <Waheedi> i assumed its good
[07:43:41] <m3t4lukas> Waheedi: good ;) If you find out it's doing cr*p you should file a bug report on jira
[07:44:29] <Waheedi> i hope not :)
[08:36:37] <Buzer> Hey. We are storing large numbers (e.g. timestamps in milliseconds) as integers in MongoDB. I noticed that when using mongoexport, those numbers are reprsented differently (e.g. 1446552221635 -> 1.446552221635e+12). Is this expected outcome?
[08:40:21] <joannac> Buzer: it should come out as extended json https://docs.mongodb.org/manual/reference/program/mongoexport/#considerations
[08:43:58] <Buzer> joannac: Thanks, that pointed to right direction. So plain numbers were actually treated as floats
[08:45:52] <m3t4lukas> when I use the java driver to store for example a double value of 2.0 there can be values like 1.999999999999994345 in the database :P Just noticed it. Out of curiosity, does anyone know how mongo stores Double?
[09:10:11] <Derick> m3t4lukas: not thta I'm aware off
[09:12:05] <m3t4lukas> Derick: would be kinda cool :3 Just like you can do with MySQL :D
[09:18:23] <m3t4lukas> Derick: sry, not MySQL but PostrgeSQL with PGStrom
[09:21:31] <m3t4lukas> and I was wrong. Depending on how you do it you'd not need to store aggregations of the server. It would be best to implement the stages themselves in CUDA/OpenCL and just pass config and data into it and let it do its thing.
[09:22:28] <m3t4lukas> The method I was thinking of before was to compile the aggregations directly into a shader (would be more runtime efficient if they are stored)
[09:23:00] <m3t4lukas> but I guess that's overkill and does not represent mongo paradigms
[10:35:54] <BlackPanx> does mongodb have any option for georeplicated setup? i'd like to have one mongo replicaset in US and one in EU. is this even possible with mongodb?
[10:37:01] <BlackPanx> to have US and EU replicasets replicate.
[10:40:53] <BlackPanx> the main problem is master and writes. i'd love to have each replicaset in each region write to it's own database which would be then replicated to anothe region or something
[10:41:27] <m3t4lukas> BlackPanx: Do you want multiple replica sets or one distributed replica set?
[10:42:03] <BlackPanx> one distributed if possible
[10:42:41] <m3t4lukas> BlackPanx: that's possible. You should read the docs on that topic
[10:43:18] <m3t4lukas> BlackPanx: there are some caveats and some things to be aware of when doing this
[10:44:01] <BlackPanx> http://blog.mongodirector.com/wp-content/uploads/2013/10/Cross-DC-Mongo.jpg
[10:44:05] <BlackPanx> this is probably the case
[10:45:19] <BlackPanx> if you look at this picture... there's a problem. only 1 master in DC1 which can do writes. I'd prefer having master in each DC so that all instances in that DC can write to it locally and then gets distributed to other DC's
[10:46:19] <m3t4lukas> BlackPanx: there may be a way to achieve that by sharding
[10:47:25] <m3t4lukas> BlackPanx: for every record add the country where you want it to be stored as string or coded integer or any way you like and use that as (part of) the sharding key
[10:50:32] <BlackPanx> i'm trying to imagine the topology
[10:51:13] <BlackPanx> https://docs.mongodb.org/v2.4/_images/sharded-cluster-scatter-gather-query.png something like this
[10:51:18] <nixstt> https://docs.mongodb.org/manual/core/tag-aware-sharding/
[10:52:26] <m3t4lukas> BlackPanx: please use 3.x doc and mongod for new Projects
[10:52:46] <BlackPanx> in this case shard A would be US datacenter replicaset of 3 instances, shard B would be EU replicaset of 3 instances and shard C would be Asia/Pacific replicaset of 3 instances. Then Driver would use tag-aware sharding which would basically make it use specific "shard" which is closest to it.
[10:53:16] <nixstt> BlackPanx: https://s3-us-west-1.amazonaws.com/morpheus-staging/system/spud_media/309/original/tagawaresharding2.jpg?1421507273
[10:53:46] <BlackPanx> nixstt yes! this!
[10:54:10] <BlackPanx> thank you both so much
[10:54:14] <m3t4lukas> BlackPanx: yeeeaaahnaah, it doesn't really choose the nearest but the one you define
[10:54:23] <BlackPanx> yes
[10:54:36] <BlackPanx> the one i define yes... but okay. i'd define the nearest :)
[10:54:45] <BlackPanx> thanks so much
[10:54:50] <BlackPanx> this is really helpful
[10:54:58] <m3t4lukas> that would be the logical choice :D
[10:55:06] <m3t4lukas> no problem dude, any time
[10:56:02] <m3t4lukas> BlackPanx: what version of mongod do you use?
[10:56:15] <BlackPanx> latest
[10:56:49] <m3t4lukas> good ;) just wanted to make sure since you used old doc
[10:56:49] <BlackPanx> wait. nope. mongodb 3.0 it is
[10:56:59] <m3t4lukas> that's fine, too for production
[11:11:45] <t0th_-_> hi, i have this problem when try connect in php: Remote server has closed the connection
[11:11:48] <t0th_-_> how i can solve?
[11:19:50] <julio> Hi! Which is the best way to install mongo-hacker at Debian 8 Jessie?. I'm trying "npm -g install mongo-hacker' but I'm receiving an permission error (I'm using sudo)
[11:20:24] <m3t4lukas> julio: does debian have sudo?
[11:20:57] <m3t4lukas> or did you install it manually?
[11:22:41] <m3t4lukas> t0th_-_: do you run on the latest versions?
[11:23:30] <t0th_-_> latest version of mongo?
[11:24:04] <julio> MongoDB shell version: 3.2.1
[11:24:26] <julio> I tryed through git clone but I don't have rights as well :(
[11:26:14] <julio> m3t4lukas, my user is in /etc/sudoers.
[12:04:58] <ehershey> 1
[12:27:02] <Freman> so, mongo, I want to find anything > $time and increase it's sequence_id by 100000
[12:29:33] <nixstt> Freman: https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/
[12:29:49] <StephenLynx> that is to return the value too.
[12:30:03] <StephenLynx> I think a simple multi : true on an update is enough for his case.
[12:30:26] <Freman> db.collection.update({date: {$gt: ISODate("2016-01-27T05:00:00Z")}}, {$inc : {sequence_id: 100000}})?
[12:32:41] <StephenLynx> you need to add the options after the change object
[12:32:44] <StephenLynx> with multi:true
[12:33:12] <Freman> db.collection.update({date: {$gt: ISODate("2016-01-27T05:00:00Z")}}, {$inc : {sequence_id: 100000}}, {multi: true})
[12:33:14] <Freman> good oh
[12:33:15] <Freman> thanks
[12:35:05] <StephenLynx> some drivers, at least the node one, have a separate function that includes the multi:true behind the scenes.
[12:35:27] <StephenLynx> in case you are also writing software that will require an update on multiple documents.
[12:35:37] <StephenLynx> updateOne, updateMany
[12:38:13] <Freman> no not normally, just something went wrong, probably due to the huge backlog it didn't get around to updating the saved sequence_id so a restart meant it was writing from an old one
[12:38:27] <Freman> we have huge problems with mongo throughput and I have no idea how to fix it
[12:38:38] <Freman> and no-one here that knows about mongo seems to give a damn
[12:39:42] <StephenLynx> welp
[12:39:43] <StephenLynx> v:
[12:39:47] <StephenLynx> there's always paid support
[12:39:54] <Freman> I'll make the app read the old sequence_id (from the one document collection it's in), find the greatest sequence_id after that, then add 10k
[12:39:58] <StephenLynx> or you can ping joannac
[12:39:59] <Freman> lol they're not going to pay for support
[12:40:05] <StephenLynx> she's mongo's employee afaik
[12:40:41] <StephenLynx> so she might pay more attention than random devs like most people here
[12:43:53] <Freman> this whole thing is becoming the bane of my existance
[12:49:09] <StephenLynx> kek
[12:49:35] <StephenLynx> yeah, mongo is pretty good, but when bad devs fuck up, they fuck up real good.
[12:49:57] <StephenLynx> it doesn't hold your hand in the slightest.
[12:54:47] <m3t4lukas> julio: sry, then I have no idea. It seems not like a mongo problem :P
[12:55:03] <Freman> yeh and I'm so busy re-writing all the things (this used to be a nodejs process until it pegged the cpu at 4 mbit - for example)
[12:56:52] <julio> m3t4lukas, ok, no problem. Fine thank you!
[12:56:55] <julio> Cheers
[13:00:18] <m3t4lukas> julio: did you try to leave out the -g to see if it works when you don't install system wide?
[13:01:36] <Freman> anyway, thanks for the chat, I'm off to sleep
[13:04:55] <julio> m3t4lukas, no. If I try without -g option, where I need to try. In my user folder?
[13:07:20] <m3t4lukas> doesn't matter where I think. As far as I know npm has a .npm directory in the user home
[13:07:40] <m3t4lukas> if not it will create some kind of folder in your cwd
[13:07:51] <m3t4lukas> was to julio
[13:09:48] <julio> m3t4lukas, it works! Cheers :DD
[13:18:16] <m3t4lukas> julio: that's great to hear ;)
[13:19:02] <m3t4lukas> julio: how did npm do it? Does it create a folder in CWD or does it use a directory in your home?
[13:22:09] <julio> m3t4lukas, it was created a folder node_modules in my current directory (~/)
[13:22:45] <m3t4lukas> julio: thanks :) it's always good to know how things work ;)
[13:22:53] <julio> :D
[13:39:51] <hernanhht> hey guys, I want to change how the query planner decides over indexes. I have 2 indexes and sometimes it chooses wrong (we have different workloads on the collection). Besides using a $hint or index filters, is there some other type of fine tuning ?
[13:46:05] <cheeser> i think that's it
[13:47:37] <cheeser> i think what's probably tripping you up is that I believe the query planner caches that plan so it doesn't have to reevaluate all the time. so if you hit it with two different needs before that cached plan is evicted you get the old one.
[13:49:51] <hernanhht> yes, that's what is happening. But I would like to fine tune this kind of behaviour
[13:50:57] <hernanhht> it happens usually with compound indexes with 3 fields for instance {name:1, lastname:1, age:1} and {name:1, lastname:1, address:1}
[13:51:27] <hernanhht> sometimes I make a query that matches exactly one of the indexes and the query planner chooses the other one
[13:52:03] <hernanhht> I know I can hint the query planner, but I don't like this solutions, it doesn't scale
[13:52:13] <cheeser> scale in what sense?
[13:52:25] <hernanhht> I have to modify a lot of code
[13:52:51] <hernanhht> I would like a way to tell the query planner, if there is an index that matches the query, uses it right away
[13:53:16] <cheeser> that's what the query planner is doing
[13:53:31] <cheeser> it's just that there's two, apparently, that reasonably fit the bill
[13:54:31] <hernanhht> yes, but it's scanning a lot of objects because it's choosing the wrong index
[13:54:53] <hernanhht> the other index will match it better
[13:55:29] <hernanhht> do you think there is a way to fine tune this kind of behavour ?
[13:58:28] <cheeser> i don't know of any beside $hint. you might ask the mongodb-users google group. more of the kernel devs monitor that.
[13:58:33] <cheeser> very few hang out here sadly
[14:00:16] <hernanhht> ok, great, thank you cheeser
[14:00:21] <cheeser> np
[14:04:12] <m3t4lukas> cheeser: why are there so few hanging out here?
[14:06:11] <cheeser> some don't care for irc. it can be pretty distracting at times.
[14:10:11] <m3t4lukas> cheeser: yeah, that's true, it can :D But many of us are devs, too :)
[15:58:17] <alexi5> hi everyone
[16:25:08] <alexi5> how practical is it to use mongodb to develop a catalog for various types of equipment with command and diffren attributes. store reports on the maintenance of these pieces of equipment. and have the database and application to be easilty modified when new equipment types are available
[16:26:29] <alexi5> most of the use cases I have come across involve the performance improvements of using mongodb
[16:27:22] <mkjgore> hey folks, so I'm trying to run an update from CLI… mongo —eval "use 'config'; db.shards.find().pretty()" is a no go because "use" is a shell command… any other way to do this? Internet is failing me atm
[16:27:33] <mkjgore> s/internet/google keywords
[16:29:25] <Derick> mkjgore: you can pass the dbname on the command line
[16:29:33] <Derick> mongo config --eval "db.sh…
[16:32:47] <mkjgore> Derick: I'm not seeing the right results… I can definitely see the proper output in the shell (proof that it's there) but not on the CLI as described ¯\_(ツ)_/¯
[16:33:37] <Derick> that's something else I'm sure, but "mongo config" starts the mongoshell with the config database selected
[16:34:51] <mkjgore> thanks anyway, I'll let you know if I can figure it out
[16:36:03] <alexi5> hi mkjgore
[16:36:03] <alexi5> hi mkjgore
[16:36:03] <alexi5> hi mkjgore: what type of applications do you develop using monogodb ?
[16:36:36] <alexi5> sorry about that having some issues with kiwirc
[16:36:47] <mkjgore> web app, user management stuff
[16:38:29] <alexi5> do you pefform any refrences between documents or is everything self contained ?
[16:38:58] <mkjgore> depends on the scenario. sometimes one, sometimes the other
[16:39:19] <mkjgore> for the most part self-contained
[16:39:50] <mkjgore> alexi5: why do you ask?
[16:41:03] <alexi5> I am developing an application that will manage network equipment where the diffrent types of equipment of the same type can have common and varying attributes
[16:42:12] <alexi5> also want the technician to fillout their maitnenance report and the content of the maintenance report may varying depending on the equipment type and their attributes
[16:42:43] <mkjgore> alexi5: you should look into salt stack
[16:42:47] <mkjgore> seems right up your alley
[16:42:59] <mkjgore> you can tie it into mongodb
[16:43:46] <alexi5> ok i'll check it out
[16:44:54] <alexi5> my intial of the schema resulted in 6 six tables and I could see it growing depending on the type of attributes
[16:52:39] <mkjgore> alexi, I know time is tough and learning new tech equally so but if you're talking about some major infrastructure you should definitely look into salt and it's contemporaries
[17:01:48] <alexi5> The equipment that I would be managing is Cell site (LTE,GSM) equipment . so far salt stack looks like it manages data center equipment and it operations
[17:02:09] <alexi5> i'll continue reading and see if it can be applied to what I am doing
[17:03:42] <GothAlice> alexi5: I use an Object Document Mapper (ODM) that supports subclassing. If, for example, SomeTypeOfEquipment has certain properties, but AnotherTypeOfEquipment has others, YetAnotherType might be "a type of" SomeTypeOfEquipment, inheriting its attributes and adding more or mutating the existing ones.
[17:03:48] <GothAlice> Makes it easy to have progressive details.
[17:04:46] <GothAlice> (The net result is there is a field on most of my documents to identify what type of document it is.)
[17:05:34] <alexi5> nice. similiar to what an ORM would with inheritance using table per hierachy
[17:05:58] <GothAlice> Pretty much, except in MongoDB there is no common schema requirement between documents in the same collection, making the whole process infinitely easier.
[17:06:09] <GothAlice> Esp. if you want to search attributes common to several types at the same time.
[17:07:16] <GothAlice> https://gist.github.com/amcgregor/c6ae92325a941ba70568?ts=4 is an XML dump example of this, with Page being a type of Asset, and all of the blocks being a type of basic Block.
[17:07:47] <GothAlice> (Career and Form also being subclasses of Asset.)
[17:09:29] <alexi5> nice
[17:10:08] <alexi5> so I guess when domain objects change there isn't much schema migrations to do
[17:10:28] <GothAlice> There can be _some_, but it's usually a fire and forget update in a mongo shell. ;)
[17:10:31] <GothAlice> $rename, etc.
[17:11:42] <GothAlice> And most ODMs let you divorce native attribute name from in-db field name, so $renames can be avoided in most circumstances, but there are others, like pivoting a badly constructed sub-document of metadata attributes to a list of sub-document-per-metadata-attribute style, that takes a touch more work.
[17:12:03] <GothAlice> Additions are free, though. ;)
[17:13:40] <alexi5> the application will need to be able to make queries e.g what are all pieces of equipment that have attribute A with value 112
[17:13:57] <GothAlice> db.fobs.find({A: 112})
[17:14:07] <GothAlice> Won't care if some of the records don't even have an A to match.
[17:14:54] <GothAlice> Or if A is a string on some of them, that's okay, too. (They won't match, but it's not explosion-worthy.)
[17:16:01] <alexi5> i am gonna make a prototye awith mongodb and see how things pan out
[17:16:11] <alexi5> thanks GothAlice
[17:16:24] <GothAlice> db.fobs.insert({A: 112}); db.fobs.insert({B: "artoo"}); db.fobs.insert({A: 42, B: 27}}
[17:16:53] <GothAlice> With that you can query all sorts of ways. There are three "types" of things, the latter combining the attributes of the other two, but with a differing type for B.
[17:17:12] <GothAlice> db.fobs.find({A: {$exists: 1}) – find everything with a value for A, any value for A.
[17:17:34] <GothAlice> db.fobs.find({B: {$type: "string"}}) – find records whose B value is a string (only the second record inserted in this example)
[17:17:36] <GothAlice> Etc.
[17:18:40] <alexi5> i guess its the simplicity of monogdb had me worried if it was for real
[17:20:50] <GothAlice> It's mostly simple at a glance. It's insanely powerful, too. For example, using the capped collection feature I use MongoDB as a distributed message queue and RPC system. Also as a logging target. Also as an atomically updated monitoring system. Also … ;)
[17:20:52] <alexi5> again thanks GotAlice for going assisting me
[17:21:11] <GothAlice> It never hurts to help. :)
[18:21:40] <euxneks> howdy, I'm interested with regards to this: https://docs.mongodb.org/manual/mongo/#exit-the-shell why the decision was ctrl+c instead of ctrl+d ... (I mean, I'm not complaining, I'm just curious - perhaps it will help me understand mongo better)
[18:22:07] <euxneks> or maybe it still accepts ctrl+d
[18:22:18] <euxneks> hunh I'll try it out
[18:22:28] <euxneks> ah it totally does
[18:22:38] <euxneks> NEVERMIND then :D I am a meat popsicle
[18:32:22] <GothAlice> euxneks: Control+C sends a SIGINT (interrupt) signal to stop whatever the foreground process is doing, generally by quitting. (A la running "tail -f".) Control+D signals "end of file" (literally by writing an EOF character) which to an interactive shell means exit, the (interactively entered) script is over. (cat > /dev/null, ^D to end transcription for a non-mongo example).
[18:33:15] <GothAlice> There is no particular meaning meant by mongo beyond "follow standard POSIX practice".
[18:35:36] <GothAlice> (Interactive REPL shells for programming languages tend to capture SIGINT in some way, a la Python's shell transforming it into a KeyboardInterrupt exception.
[18:36:03] <GothAlice> But MongoDB's shell isn't a programming REPL shell, it's a DB shell. ;)
[18:41:13] <mkjgore> Derick: FYI, the issue wasn't that it wasnt returning the data, I just didn't realize it was returning a cursor so I had to surround the "db.shards…()" with "printjson(…)"
[18:41:17] <mkjgore> issue resolved
[18:41:22] <mkjgore> (☞゚ヮ゚)☞
[18:51:32] <Derick> mkjgore: hah - ok
[18:57:07] <euxneks> GothAlice: thanks for the info :)
[19:13:20] <GothAlice> Hmm. Selecting multiple embedded documents in an array with a filter. My eternal problem.
[19:16:32] <pancakes9> Hi, do you offer help with third party packages like https://www.npmjs.com/package/mongo-express?
[19:17:36] <pancakes9> I'm trying to set it up with my Mongo setup and it won't come up on my host
[19:17:58] <pancakes9> The host address doesn't seem to take anything other than localhost?
[19:19:01] <StephenLynx> express is crap
[19:19:13] <StephenLynx> try the standard driver.
[19:26:11] <pancakes9> Can I just swap it out?
[19:26:30] <pancakes9> StephenLynx: seems like "mongo-exress" relies on Express...?
[19:28:37] <pancakes9> I guess this is more of a sysadmin question but whenever I start it keeps throwing the error "Error: listen EACCES 127.0.0.1:80"
[21:48:16] <cheeser> the same as the answer for "how many push ups can Chuck Norris do?"
[21:52:21] <Freman> not many apparently
[21:56:47] <cheeser> "all of them" is the correct answer
[21:58:34] <echelon> hi
[21:59:33] <Freman> except it seems ot bog down and stall
[21:59:41] <Freman> resulting in a backlog
[22:08:31] <cheeser> Freman: yeah. such numbers are always dependent on hardware and such.
[22:09:56] <GothAlice> Freman: Might be a good idea to check iotop to see if your disks/filesystem is capable of keeping up.
[22:10:15] <GothAlice> High iowait times on mongod would indicate "no".
[22:10:50] <GothAlice> (Would exhibit as an absurdly high load average when it gets particularly bad.)
[22:11:07] <Freman> that is the thing tho, the load on these machines is so low :(
[22:12:59] <GothAlice> Hmm; I might be wrong about the LA thing. Linux kernel devs might have fixed the "io backlog = infinite LA" issue.
[22:13:45] <GothAlice> iowait is the correct measure.
[22:14:12] <Freman> eventually whatever is causing the backlog goes away and our backlog empties into mongo at quite the rate (our bulks are limited to 1 (up to 4 concurrent) x up to 1000 documents every 1 second (which ever comes first, 1000 documents, or 1 second)
[22:14:41] <Freman> next time there's a backlog I'll watch iotop
[22:16:05] <BigOrangeSU> Does anyone have a strategy for running an update with a forEach but only for 50,000k records?
[22:16:25] <cheeser> come again?
[22:16:27] <Freman> 104857600 bytes (105 MB) copied, 0.855714 s, 123 MB/s
[22:16:51] <BigOrangeSU> cheeser: I have a specific 50k objectids I want to run an update for
[22:16:52] <Freman> disk itself is plenty fast, cirtainly faster than the 200kb/s the input steram maxes out at
[22:17:12] <cheeser> BigOrangeSU: and so what's the problem?
[22:17:35] <GothAlice> Freman: That's a pretty good batching strategy, though one second seems a bit tight to me. ;)
[22:17:56] <Freman> it's a limitation of real time logs... they want them real time
[22:18:29] <BigOrangeSU> cheeser: How can i write a query for hte specific 50k ids? Do I use an $in : [] with 50k records
[22:18:30] <Freman> tho today I'm going to propose they subscribe to the log processor directly to get the logs vs pull them from mongo post insert
[22:18:41] <Freman> then I can batch however the hell I feel like it :D
[22:19:09] <cheeser> so this 50k is a subset of your data?
[22:19:09] <GothAlice> Freman: Heh. Our atomically updated analytics are "live" (no count-based or time-based batching), with hits over a capped collection for realtime tools to get more detailed information. (Tailing capped collections as a data processing pipeline we find to be quite effective.)
[22:19:16] <BigOrangeSU> cheeser: Yes
[22:19:20] <cheeser> ah
[22:19:35] <BigOrangeSU> cheeser: there is no way within mongo to determine those 50k without iterating over evry record which would be inefficent
[22:19:40] <cheeser> i don't think you want a $in with a 50k large array
[22:20:02] <GothAlice> cheeser: Aren't query documents also limited by the 16MB rule?
[22:20:02] <Freman> yeh these aren't capped collections
[22:20:14] <BigOrangeSU> ya exactly so whats the strategy lol
[22:20:22] <Freman> not my choice, I've argued for capped collections
[22:20:26] <cheeser> GothAlice: they are actually.
[22:20:42] <cheeser> BigOrangeSU: i would probably break it up in to chunks
[22:20:52] <cheeser> do 100 IDs or a 1000 at a time.
[22:21:09] <cheeser> depending on what your updates look like
[22:21:40] <cheeser> if you have those IDs application side, you could just do 50k updates, e.g.
[22:22:15] <GothAlice> BigOrangeSU: That's a strategy we use at work for bulk processing updates against things like our invoices. (Though we spawn a distributed task per grouping to let us scale the parallelism of that separately.)
[22:27:36] <GothAlice> BigOrangeSU: It sounds, though, that whatever you're using as selection criteria for those 50K IDs should instead be merged into the dataset you are actually querying; then you wouldn't need to $in anything.
[22:28:46] <echelon> hey guys
[22:28:49] <GothAlice> (MongoDB encourages one to model your data the way it's used, rather than in some pristine "perfect at-rest structure".)
[22:28:53] <GothAlice> Hey-o, echelon.
[22:28:53] <echelon> why am i getting this error: http://pastebin.com/raw/uzY9ySNU
[22:29:11] <echelon> exception:BSON representation of supplied JSON array is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:361
[22:29:51] <cheeser> that'd be why, i'm guessing
[22:30:01] <GothAlice> Even tells you exactly where to look.
[22:30:07] <echelon> line 361?
[22:30:20] <GothAlice> Either line 361 or character 361.
[22:30:32] <echelon> character? :|
[22:30:33] <GothAlice> What's the 361st byte of that file?
[22:30:35] <echelon> how do i find that in vim
[22:31:19] <GothAlice> with open('file.json') as fh: fh.seek(361); print(ord(fh.read(1)))
[22:31:30] <GothAlice> ^ a three-liner in a Python shell.
[22:31:37] <echelon> k
[22:31:49] <GothAlice> (newline after : and ;, second and third line indented, ; removed)
[22:34:52] <GothAlice> Uhh, is ISODate a JSON thing?
[22:35:29] <echelon> i dunno man
[22:36:09] <cheeser> it is not.
[22:36:18] <cheeser> it's the "extended json" that mongodb uses.
[22:36:45] <BigOrangeSU> GoWithALice: I can't its imposisble
[22:37:20] <GothAlice> BigOrangeSU: Very few things are actually impossible. ;P
[22:43:36] <echelon> GothAlice: here's the original.. http://pastebin.com/raw/vZHCNWsp
[22:43:55] <echelon> and your python script just returns 32
[22:49:41] <Freman> != meaning of life and all that
[22:53:11] <echelon> heh
[23:27:11] <gardenmwm> Hi, I'm *really* hoping this is a stupid question, but I'm running into a problem where I can see several hundred files via the mongo api's (pymongo and some java mongo) but when I connect with the mongo client, I only see a few files
[23:27:34] <StephenLynx> files?
[23:27:37] <StephenLynx> what do you mean?
[23:28:35] <gardenmwm> I'm using gridfs, using the gridfs api drivers I can see everything fine. However I need to delete a few files, so I'm attempting to do it via the mongo shell
[23:29:07] <gardenmwm> none of the file id's I am trying to delete are in the fs.files collection, only about 20 or so files exist.
[23:29:24] <gardenmwm> however, if I use mongofiles on the same db, I get around 460
[23:29:37] <StephenLynx> use show collections
[23:29:44] <StephenLynx> do you see anything unexpected?
[23:30:16] <gardenmwm> nope, just dummyData, fs.chunks, fs.files and system.indexes
[23:30:22] <StephenLynx> hm
[23:30:33] <StephenLynx> where do you see 460 files?
[23:31:10] <gardenmwm> mongofiles -db mydeqfiles list | wc -l
[23:31:32] <gardenmwm> shows 462, however if I use db.getCollection('fs.files').find({})
[23:31:56] <gardenmwm> I only get around 40 or so
[23:32:00] <StephenLynx> try reading the raw output from mongofiles
[23:32:19] <StephenLynx> see what are the files present there that are not on the find
[23:32:27] <StephenLynx> and btw, you can just use db.fs.files.find()
[23:33:18] <zeioth> Hi, I have a model like (_id, date) where index is (_id + date). If I filter by date, i need to create another index for the date field, or the (_id + date) index will be used?
[23:33:51] <StephenLynx> not too well.
[23:34:03] <StephenLynx> I suggest creating just the date index.
[23:34:36] <zeioth> my point is
[23:34:47] <zeioth> if i have a compound index, and i do a query to a single field
[23:34:59] <StephenLynx> if can use the FIRST part of the index.
[23:35:07] <StephenLynx> its called
[23:35:08] <StephenLynx> I forgot
[23:35:11] <StephenLynx> prefixes I guess
[23:35:21] <StephenLynx> if your index is a_b_c and you query for a_b, you will use the index still
[23:35:38] <zeioth> thats great, thank you ^_^
[23:35:38] <StephenLynx> but if you use b_c it won`t work as well or might not even work
[23:35:46] <zeioth> oh
[23:35:56] <gardenmwm> @StephenLynx ok, so I'm an idiot. Didn't realize mongo paginates output. Thanks for helping
[23:36:00] <StephenLynx> the important part is not skipping fields.
[23:36:01] <StephenLynx> np
[23:36:11] <StephenLynx> as long as you don`t skip fields, you will use the index.
[23:36:17] <StephenLynx> even if you don`t use all fields
[23:37:48] <zeioth> got it: https://docs.mongodb.org/manual/core/index-compound/#prefixes
[23:39:57] <HarryKuntz> hi