PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 5th of October, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:08:55] <hjando> Hey there. I'm attracted to mongo for its lack of schema for quicker development and the simplicity of storing my data as documents. However, I really don't think my data model has any reason to be otherwise. My data is structured and has a few relations. Is it worth it to shoehorn what should probably be represented in a relational database into mongo?
[02:31:32] <melissamm> Does anyone know how to store collections as heaps? http://stackoverflow.com/questions/32940372/how-to-store-data-in-a-mongodb-collection-as-a-heap
[02:55:24] <melissamm> db.foo.find().sort({the_field: 1}).limit(1) Sorting basically the same thing hundreds of times per minute would be bad, wouldn't it? Or is MongoDB so very efficient that it can handle this?
[02:59:18] <cheeser> is 'the_field' indexed?
[03:00:19] <melissamm> @cheeser, would it help if it were?
[03:00:28] <melissamm> I'm starting from scratch and just learning it
[03:00:44] <melissamm> I don't know about index but can add it
[03:03:02] <cheeser> it would absolutely help
[03:03:49] <melissamm> but do I still have to call find().sort() each time?
[03:04:03] <melissamm> btw thanks @cheeser for helping out
[03:07:43] <cheeser> are you trying to find the minimum value?
[03:08:24] <melissamm> yes
[03:08:32] <melissamm> I ONLY need the minimum value
[03:09:59] <cheeser> you'll want that sort, yes
[03:12:28] <melissamm> would indexing on the field and then run find().sort() each time be better than using $min?
[03:14:14] <cheeser> $min isn't quite what you think it is
[03:16:41] <melissamm> oh @cheeser, I'm trying to get $min to work by db.the_collection.aggregate({$min:{"$the_field"}})
[03:16:46] <melissamm> and it's not working
[03:17:07] <melissamm> what should I do to make $min work @cheeser?
[03:18:57] <cheeser> use sort().limit()
[03:21:43] <melissamm> can you explain what $min is @cheeser?
[03:21:51] <melissamm> because the docs are quite terse
[03:34:13] <melissamm> Oops, maybe I should look at this $min
[03:48:59] <melissamm> http://stackoverflow.com/questions/32940972/what-is-mongodbs-min-how-is-that-different-from-find-sortthe-field-1-l
[03:56:53] <darius93> is there anything additional i should do to prevent any form of injection attacks?
[05:53:04] <pagios> guys num_tutorial : {$sum : 1} what is 1 here?
[05:53:23] <pagios> is it like $sum = $sum + 1 ?
[05:53:43] <pagios> so if i put $sum: $likes is it like saying $sum = $likes + $sum?
[06:49:48] <pagios> are you reading me?
[07:12:06] <pagios> is it better to store media files inside mongo using gridfs or just on regualr fs ?
[07:17:11] <kali> pagios: it means "sum 'one' for each document". it's a count
[07:17:31] <pagios> kali: sum = sum + 1 ?
[07:18:26] <kali> count = ∑ 1 over the documents
[07:21:02] <pagios> huh
[08:04:53] <pagios> 2015-10-05T11:00:14.517+0300 I JOURNAL [initandlisten] preallocating a journal file /media/removable/SD Card/mongodb/data/db/journal/prealloc.0 <-- when mongodb is being started, initialization hangs for like 5 minutes at this step any idea?
[08:06:15] <pagios> JOURNAL [durability] Durability thread started
[08:06:16] <pagios> 2015-10-05T11:01:22.709+0300 I JOURNAL [journal writer] Journal writer thread started <-- then i get it working
[08:06:16] <kali> pagios: you're probably using a file system that does not allow fast preallocation (some version of FAT probably, as it is a SD card)
[08:06:31] <pagios> kali, yes i am using an sdcard, formatted as ext4
[08:07:31] <kali> mmm ext4 should be fine, actually
[08:08:23] <kali> sdcard are usually slow, but it should not be that much of an issue with ext4
[09:07:08] <BlackPanx> hello guys
[09:07:27] <BlackPanx> does mongodump create smaller backup than database actually is ?
[09:08:09] <BlackPanx> i have 160GB used space from mongodb and i still have 122GB free space. i'd like to do mongodump on same server. problem is i can't expand the disk space...
[09:10:11] <BlackPanx> in rockmongo i see: Size Storage Size Data Size Index Size Collections Object, is there any field i can "discard" when calculating storage used by backup ?
[09:10:39] <BlackPanx> or better question
[09:10:43] <kali> BlackPanx: "data size" should match the dump size
[09:10:44] <BlackPanx> is it possible to compress backup
[09:10:44] <BlackPanx> :D
[09:11:49] <BlackPanx> um
[09:11:55] <BlackPanx> this is like 30GB
[09:11:57] <BlackPanx> ...
[09:12:00] <kali> you can pipe mongodump output to gzip, but that will only work for collections dumps
[09:12:00] <BlackPanx> is it possible ?
[09:12:10] <kali> BlackPanx: not unheard of
[09:12:37] <kali> also... you're aware you can perform the dump on another system, right ?
[09:15:54] <BlackPanx> yes of course.
[09:16:46] <BlackPanx> that's what i'd do if there was no way of making dump on local store
[09:29:16] <Uatec_> greetings
[09:29:18] <Uatec_> the documentation says that {"$date": xxx } and new Date(xxx) are semantically the same (http://docs.mongodb.org/manual/reference/mongodb-extended-json/)
[09:29:25] <Uatec_> however my queries only work when i use new Date(xxx) but not using $date...
[09:29:31] <Uatec_> how come this happens? does anybody know if i'm missing something?
[10:19:08] <amcsi_work> Is it possible to index an array of references?
[10:19:46] <amcsi_work> and do selection based on whether an item has a reference to a specific id?
[10:34:21] <Ross_> Hi
[10:34:44] <Ross_> Could anybody help me with the following - I have a simple collection with 2 fields - _id and condition (hash)
[10:35:13] <Ross_> Condition is a hash tree with many nested levels and flexible structure
[10:35:32] <Ross_> I need to serach the condition field for existence of specific leaves
[10:36:01] <Ross_> for exmaple does condition contain { name: Alex; status: Active }
[10:36:27] <Ross_> { name: Alex; status: Active } may be anywhere so position of it is not known
[10:36:34] <Ross_> therefore I cannot use dotted notation
[11:20:47] <amcsi_work> how do I list items from a collection where prop1 (that contains an array of references) contains a reference of my choice?
[11:39:10] <Mattias> BlackPanx: You can dump it over ssh to your local machine. Won't even touch the server space
[11:58:14] <BlackPanx> does anyone remember since which version of 2.4.* mongodb, oplog syntax changed ?
[11:58:19] <BlackPanx> i know there were differences
[11:59:42] <BlackPanx> it was: 1373658837:993 before, then it was t: 203948203948 i: 234 or was it the other way around
[13:35:15] <BlackPanx> i wish to rename my replSet name.... there can be "downtime". Can i simply just shutdown mongodb instances and change replSet, then start them up again ?
[13:35:21] <BlackPanx> is this an option?
[14:24:39] <maxkelley> hi all, does anyone have suggestions on storing application settings in mongodb? For example, essentially what I want is a collection within my database which is "globalSettings", which would have a single dictionary of key-value pairs... Is that the right way to go about it?
[14:25:08] <cheeser> sure. why not?
[14:25:23] <cheeser> unless some of those settings are connection credentials. ;)
[14:26:06] <maxkelley> hahaha, no :) I guess my question is, should I be creating key-value pairs so that each pair is a document? I guess how do I enforce that there's only ever one document?
[14:26:29] <cheeser> i do one document, personally
[14:26:37] <cheeser> *i'd* do ...
[14:27:43] <saml> is mongodb a good company to work at?
[14:28:46] <saml> it depends. if you do one document, you need utility functions to update a single entry
[14:28:51] <maxkelley> so, as a test, I put some values in the first document, as an example: {'name': 'Max'}, and then I tried to do an update({}, {'Gender': 'Male'}, upsert=True), and I ended up with just {'Gender': 'Male'}... is there a more elegant way than appending the document?
[14:29:05] <saml> if you do multiple docs where _id is configuration key, you can just use mongod shell
[14:29:40] <saml> and you need to think about different envirionments.. if you do qa, staging, production, ... etc
[14:31:34] <saml> downside of multiple docs is that you need utility functions to get full configuration. or db.globalSettings.find()
[14:32:06] <saml> not sure why you want to put configuration in db though
[14:32:42] <saml> i version control configuration file. and have a static http server serving it with basic auth.. and apps just do http GET at startup or reload
[14:34:19] <maxkelley> Yeah, so this is going to serve as a database for a python application which users run on their own machines, so we need someplace to store common values like directories, server IPs, etc.
[14:34:58] <maxkelley> So it's not a web application at all, so there won't necessarily be staging, production, etc. environments per se? The DB server will be running local on each user's machine.
[14:35:08] <Uatec_> @cheeser, Kibana stores it's config in ElasticSearch...
[14:35:10] <Uatec_> seems a sane idea
[14:35:52] <saml> you're distributing python interpreter + your scripts + mongodb to users?
[14:35:53] <maxkelley> I'm migrating from SQLite because the application data is essentially large nested dictionaries which don't lend themselves well to SQLite storage, but mongodb is all about that.
[14:36:04] <maxkelley> saml: yepper
[14:36:18] <saml> and you're bundling mongodb just for configuration?
[14:36:35] <saml> is configuration changing during python script lifetime?
[14:37:16] <maxkelley> saml: lifetime as in... runtime, or...?
[14:37:18] <saml> i mean while script is running, configuration would change? changed by who?
[14:37:54] <maxkelley> the only way it would be changed would be if the user opened the settings dialog from within the application and changed stuff.
[14:38:00] <maxkelley> locally, not remotely.
[14:38:24] <saml> why not use json file as persisting configuration?
[14:38:29] <saml> or yaml
[14:39:07] <maxkelley> saml: because we need to implement a database for the rest of the data, so I figured why not just add a collection to it? that is a valid point, though.
[14:39:34] <saml> oh i see. bundling mongodb just sounded ambitious
[14:40:33] <maxkelley> haha yeah... I got the idea from Ubiquiti's Unifi controller S/W, which is a software controller for wireless access points... it bundles Mongo!
[14:40:36] <saml> i bet there's pure python dictionary database thingy
[14:42:22] <maxkelley> hmmmm... I might look into that.
[14:42:24] <maxkelley> thanks!
[14:44:08] <saml> if you want simple key-val, there's always dbm
[14:44:59] <saml> but looks like you want more structure. just include mongodb. make mongodb largest installed database in the world
[14:45:33] <maxkelley> hahaha, thanks, I'll try my best :)
[14:49:15] <symbol> Any of you node.js devs have an opinion on waterline? I like the native node.js driver but things just feel messy. I'd like to get some sort of structure and I know Mongoose is the devil.
[14:53:16] <saml> node.js is the devil
[14:53:38] <symbol> So many devils.
[14:53:45] <StephenLynx> node is not the devil.
[14:53:53] <StephenLynx> fastest scripted runtime environment for web.
[14:54:01] <StephenLynx> js is the closest scripted language to C
[14:54:15] <StephenLynx> largest repository count.
[14:54:24] <symbol> StephenLynx: I know you use the native driver but do you use any ODM like things?
[14:54:28] <StephenLynx> node is just misused a lot, like anything popular and acessible.
[14:54:32] <StephenLynx> no.
[14:59:24] <cheeser> i'm a fan (and maintainer) of ODMs but they seem a bit extraneous with js
[14:59:33] <cheeser> you're already dealing with dicts, essentially.
[15:00:56] <StephenLynx> yeah.
[15:00:58] <symbol> That's a good point - I'm mostly looking for creating some clean strucure. All the examples on the web I've found keep showing examples that open a MongoClient for each collrvyion.
[15:01:06] <StephenLynx> I can understanding them on a different context, but in JS is very redundant.
[15:01:53] <symbol> *collection
[15:01:54] <StephenLynx> symbol first lesson on creating clean software on js: do the opposite of what the js community tells you.
[15:02:02] <symbol> haha :)
[15:02:03] <StephenLynx> I can understand*
[15:02:25] <StephenLynx> I can show you my code
[15:02:29] <symbol> I'm a ruby dev and I'm used to having ActiveRecord.
[15:02:36] <StephenLynx> no idea whats that
[15:02:51] <symbol> I think you actually linked me before but I didn't quite understand how you were connecting to the db from the example.
[15:03:05] <StephenLynx> ah
[15:03:07] <symbol> Eh, it's just a fancy ORM that keeps the MVC clean.
[15:03:15] <StephenLynx> you got the link?
[15:03:26] <symbol> I don't think so, if you could link me again, that'd be great.
[15:04:09] <StephenLynx> https://gitlab.com/mrseth/LynxChan/blob/master/src/be/db.js
[15:04:21] <StephenLynx> like 666
[15:04:22] <StephenLynx> kek
[15:04:48] <StephenLynx> notice how I have variables for each collection I might use.
[15:04:56] <StephenLynx> and functions that retrieve these collections.
[15:05:17] <StephenLynx> the rest of the software never touches the main connection.
[15:05:26] <StephenLynx> only these collection pointers
[15:05:39] <symbol> Interesting. And you're calling them cached since you index them I assume?
[15:05:54] <StephenLynx> no, its because they are a cache.
[15:06:07] <StephenLynx> I don't get a new reference to the collection each time something asks for the collection.
[15:06:12] <StephenLynx> I just keep reusing them.
[15:07:01] <symbol> Oh, I see now.
[15:07:48] <StephenLynx> thats how I deal with the database on a clean fashion.
[15:07:56] <StephenLynx> it also prevents me from making typos.
[15:08:15] <StephenLynx> and getting a reference to a collection I shouldn't.
[15:08:20] <symbol> I really like that - where's your CRUD logic?
[15:08:28] <StephenLynx> because if I try to use the wrong function, it will crash.
[15:08:38] <StephenLynx> I don't abstract that.
[15:08:50] <StephenLynx> I just use the collection as needed.
[15:08:59] <StephenLynx> I only abstract how I store logs.
[15:09:12] <StephenLynx> because there are several operations that follow up a log insertion.
[15:09:38] <symbol> Gotcha - I'm reading through some of your logic now.
[15:10:07] <StephenLynx> at this point, most of the code have been cleaned up. so you shouldn't have any issues reading it.
[15:10:10] <symbol> I seee now - you have your API that uses your engines.
[15:10:18] <StephenLynx> just keep in mind I order functions from bottom to top.
[15:10:29] <StephenLynx> and not from top to bottom
[15:10:34] <StephenLynx> two apis, actually.
[15:10:39] <StephenLynx> the json api
[15:10:42] <StephenLynx> and the form api.
[15:10:56] <StephenLynx> the json api is just named api because it uses the api subdomain.
[15:11:08] <StephenLynx> the form api is named form and uses the main domain.
[15:11:18] <symbol> I know you don't like Express but that's what I'm currently using and I was struggling with where to store the DB logic and the actually driver code. I like how you structured things.
[15:11:29] <StephenLynx> express is garbage.
[15:11:34] <StephenLynx> even the creator left it
[15:11:55] <symbol> I'm considering moving to something new with more structure.
[15:11:56] <StephenLynx> and IMO, any web framework is pointless and harmful.
[15:12:11] <StephenLynx> it abstracts something already abstracted meant to be used directly.
[15:12:16] <symbol> Are you suggesting I roll my own?
[15:12:18] <StephenLynx> yes.
[15:12:26] <symbol> That seems more error prone unless I'm insanely talented.
[15:12:27] <StephenLynx> not your own framework
[15:12:38] <StephenLynx> just your own structure for the specific project.
[15:12:50] <StephenLynx> is not error prone.
[15:12:57] <StephenLynx> its dumb easy.
[15:13:33] <symbol> aye.
[15:13:34] <StephenLynx> it will make your software faster, easier to read and easier to maintain.
[15:14:24] <symbol> I've never done it but I'll give it a try.
[15:14:38] <StephenLynx> and unless your development cycle is extremely short, like 2 weeks, the time you spend doing it is negligible.
[15:14:54] <StephenLynx> plus it will teach you about how the runtime environment works.
[15:15:32] <symbol> I suppose it's about time I stop staying high level
[15:15:44] <symbol> Thanks for the words of wisdom StephenLynx
[15:15:57] <StephenLynx> that is a relative concept. IMO, what I do is high level.
[15:16:13] <StephenLynx> I don't know how http is implemented, I write scripts that run on native code.
[15:16:40] <StephenLynx> that can't be considered low level when there is so much below my work.
[15:17:25] <StephenLynx> using webframeworks is just over-abstracting, IMO. you are abstracting something abstracted.
[15:17:59] <StephenLynx> the difference lies when the abstraction affects your system logic and design.
[15:18:07] <StephenLynx> that is when I find excessive.
[15:19:28] <StephenLynx> not that I oppose any framework, I find them justifiable on few cases, like when you build an engine and provides a framework to access it. examples being game engines and SDKs (android, ios)
[15:19:58] <StephenLynx> or when you already know the foundation of the runtime environment and just want to assemble a quick project in a very short timespan.
[15:20:16] <StephenLynx> so you won't face any issue that you will be clueless of what is causing it.
[15:22:14] <symbol_> That makes sense.
[15:22:34] <symbol_> It's interesting because in the Ruby community, everyone is all about frameworks like Rails.
[15:22:48] <StephenLynx> from my experience
[15:22:55] <StephenLynx> webdevelopers shouldn't be allowed near a computer.
[15:23:00] <StephenLynx> let alone developing software.
[15:23:19] <symbol_> haha
[15:23:42] <StephenLynx> you wouldn't believe the crap I read from the node community before I isolated myself from them
[15:24:06] <StephenLynx> literally there was a dude that said he wanted to not have to write any code and let dependencies to everything for him.
[15:24:13] <symbol_> Well, your code speaks for you. It is readable and nicely organized.
[15:24:37] <symbol_> You've deinitely encouraged me to try my hand at it. I thought I was being low level using something like express instead of Sails.
[15:24:50] <StephenLynx> kek
[15:24:55] <symbol_> kek?
[15:25:02] <StephenLynx> when most of your data is an array of bits
[15:25:05] <StephenLynx> then you are low level
[15:25:06] <StephenLynx> v:
[15:55:38] <nosocks> Hi all. Do indexes apply retroactively to data already stored in mongo? We had some slow queries, and a co-worker applied an index to the field causing slow queries, but it doesn't seem to have sped up our queries at all
[15:55:47] <nosocks> Is there a command to apply that index to existing data?
[15:56:28] <StephenLynx> yes, it does.
[15:57:14] <StephenLynx> maybe the problem was not the field not being indexed, maybe he applied to the wrong collection
[15:58:40] <nosocks> StephenLynx: Thanks for the answer. I am 100% sure about that field being the culprit, but perhaps my co-worker applied the index incorrectly. I'll have to have a closer look
[16:11:44] <nosocks> When an index is being created in mongo, how do we know when it is completed? When I run .getIndexes(), I see "background": true
[16:12:29] <kali> nosocks: look if you can find it in db.currentOp()
[16:12:56] <nosocks> > db.currentOp() { "inprog" : [ ] }
[16:13:03] <cheeser> there you go
[16:13:13] <nosocks> fantastic, thanks for that. didn't know about that command :)
[16:27:29] <ams_> If I cap a db afte
[16:27:34] <ams_> If I cap a db after it is massive, will it shrink?
[16:32:18] <ams_> I did convert to capped (5gb) but there's 80 of files still
[16:36:16] <StephenLynx> are you sure you can make a database capped?
[16:36:35] <StephenLynx> all I can find is about capped collections.
[16:49:35] <Fardin> Hi guys! I need to update some documents to replace their contents with a subdocument i.e. {foo:{bar:"",baz:1}} => {bar:"",baz:1}
[16:49:43] <Fardin> How can I achieve that result?
[16:55:53] <symbol_> I don't follow your example.
[16:56:51] <symbol_> Do you want to remove the foo field and and take the values from that to make two new fields?
[16:56:58] <cheeser> you'll have to do that in your app. you can't really do it directly in mongodb.
[16:57:14] <deathanchor> mongodb javascript script :D
[16:57:30] <daidoji1> how does pymongo determine the type of a number from a record?
[16:57:53] <daidoji1> bson says it supports int32, and I store an int value in the record, but when I retrieve it gets cast to a float in python
[17:00:53] <Fardin> cheeser, I'm under the impression that mongodb's own javascript parser can handle any kind of scripts. Am I right deathanchor ?
[17:01:10] <Fardin> In any case, how can I do that?
[17:01:37] <cheeser> it's V8, iirc, so you could write javascript to do so, yes.
[17:01:47] <Fardin> symbol_, something along those lines. I have imported some data, and they all have an extra parent which I need gone
[17:02:13] <cheeser> but you can't really do what you want inside the update statement.
[17:02:35] <Fardin> cheeser, so I should just query, cache, remove and insert?
[17:02:46] <cheeser> more or less, yes.
[17:03:07] <cheeser> or just, find, "cache", update the document, update back in to the db.
[17:03:09] <cheeser> no need to remove.
[17:05:16] <daidoji1> anyone help me with this type issue?
[17:05:28] <Fardin> cheeser, I just took the safer route, since I'm new to MongoDB and NoSQL in general ;P
[17:12:38] <daidoji1> :-( guess not?
[17:13:42] <Fardin> daidoji1, this may not be the best channel to ask that question!
[17:14:27] <daidoji1> Fardin: why not?
[17:14:52] <daidoji1> pymongo is maintained by Mongo and people in here have experience with that driver although many of them may be silent right now
[17:15:17] <Fardin> daidoji1, oh well, than pardon me. I did not know that
[17:16:09] <daidoji1> no worries
[17:16:30] <daidoji1> what I'm trying to do isn't really kosher for a document database anyways but I thought I would ask
[17:18:19] <symbol_> daidoji1: I'm assuming it's just the driver formatting it. The shell does the same thing despite the integer being stored as an int32
[17:18:52] <daidoji1> symbol_: yeah thats what I figure too
[17:19:20] <daidoji1> doesn't seem like there's info on how to override that or what the rules are for that in the documentation though :-(
[17:20:45] <symbol_> daidoji1: Are you saying that you store something like 10 and get 10.0 back?
[17:27:42] <daidoji1> symbol_: yeah
[17:28:12] <daidoji1> but between the loose typing of pymongo and mongo its hard to tell where/how/why that happens
[17:29:03] <symbol_> I think that's pretty standard behavior from the Mongo driver and you just need to turn it into an int application side.
[17:30:37] <daidoji1> symbol_: yeah apparently I have to do voodoo like this to store as a certain type on the loading side http://stackoverflow.com/questions/8817856/pymongo-64bit-unsigned-integer
[17:30:51] <daidoji1> but this particular tool was only supposed to warn on incorrect types
[17:32:54] <topwobble> If I index, foo, will count({foo: {$exists:false}) be able to run using just the index (ie. not go to disk)? I am not sure if undefined values get indexed
[17:33:51] <cheeser> topwobble: run that with .explain() and see
[17:34:51] <topwobble> Id like to figure that our before running as it may take a long time if not using index
[17:35:23] <cheeser> no dev server?
[17:35:34] <cheeser> you could dummy it up on a separate collection
[17:36:34] <topwobble> i guess i could do that. 1 sec ;)
[17:37:01] <topwobble> someone on quora is saying: db.collection.count({"foo":null}) will work as indexes will store null for undefined values
[17:37:53] <topwobble> oh yea... the issue is I dont have the index built yet ;)
[17:38:09] <topwobble> so ill try explain() in a couple hours when it builds
[17:42:43] <cheeser> or on another collection in 3 minutes. ;)
[17:46:16] <topwobble> @cheeser i need the index on staging anyways so i dont mind building it. Fun to see how long it takes
[17:47:39] <topwobble> 25% done already
[17:49:17] <topwobble> "db.currentOp().inprog[0].secs_running" is a valid command to get time an op has been running. Pretty cool
[18:48:57] <deathanchor> topwobble: db.currentOp({ active : true, waitingForLock : false, secs_running : { $gt : 10 } })
[18:49:21] <deathanchor> or remove the secs part to see what is actively writing/reading
[18:49:47] <topwobble> deathanchor nice! So flexible!
[19:10:49] <topwobble> ok indexed staging. This is the explain() of find({key: null}). Looks like it's 100% indexed... right? https://gist.github.com/objectiveSee/eaf97ea74ee10f948678
[19:11:01] <topwobble> never seen `KEEP_MUTATIONS` before
[19:17:18] <G1eb> Hi! what are the popular frameworks for rapid webdev using mongo as db nowadays?
[19:17:26] <StephenLynx> none.
[19:17:34] <StephenLynx> they are all awful garbage.
[19:17:37] <G1eb> that's quick
[19:17:50] <G1eb> i remember using mean couple years ago
[19:17:55] <StephenLynx> ew
[19:18:03] <G1eb> checked it out now and its all modules this blabla that
[19:18:15] <StephenLynx> specially with js, using frameworks and ODMs is pointless.
[19:18:19] <StephenLynx> just use the native driver.
[19:19:22] <G1eb> i was looking into working with mongo a bit more, having something that takes care of the ui would be nice
[19:19:37] <G1eb> like, as little frontent as possible
[19:19:57] <StephenLynx> that makes absolutely no sense.
[19:20:09] <G1eb> and the first page that mean generates is basically a price table :p
[19:20:29] <StephenLynx> tying GUI with the database is one of the worst mistakes you can make in software design.
[19:20:46] <G1eb> what no
[19:21:07] <G1eb> wait, its just a simple ui that collects data
[19:21:42] <G1eb> data format is simple too
[19:22:28] <StephenLynx> still stying GUI with the database.
[19:22:46] <StephenLynx> this whole "MEAN" stack is bollocks, imo.
[19:22:58] <G1eb> could not agree more
[19:23:00] <StephenLynx> it makes absolutely no sense to tie a front-end library to a database.
[19:23:07] <StephenLynx> and express is crap.
[19:23:21] <G1eb> oh and don't get me started on jade, right? :p
[19:23:24] <StephenLynx> it just demeans node and mongodb.
[19:23:26] <StephenLynx> never used it.
[19:23:43] <G1eb> thank your lucky stars
[19:23:47] <StephenLynx> I have a hint is bad, but I try to not shit talk things I don't know about.
[19:23:56] <G1eb> http://jade-lang.com/
[19:23:57] <StephenLynx> I just use jsdom
[19:24:11] <StephenLynx> so my templates can be pure HTML and I can use a real standard to build html.
[19:24:34] <StephenLynx> still a little bloated for my taste, but is the one that tick more boxes to me.
[19:25:44] <StephenLynx> >forced indentation
[19:25:47] <StephenLynx> oh god
[19:26:31] <G1eb> :'D
[19:33:01] <G1eb> StephenLynx, http://codeofrob.com/entries/you-have-ruined-javascript.html
[19:34:12] <StephenLynx> I don't give a hoot about front-end, honestly.
[19:34:31] <StephenLynx> if you read my front-end js and my back-end js, you wouldn't believe they were written by the same person.
[19:34:46] <StephenLynx> front-end technology is awful, period.
[19:34:51] <StephenLynx> because users are awful.
[19:34:57] <StephenLynx> that causes managers to be awful
[19:35:05] <StephenLynx> and programmers that stick to this thing to be awful.
[19:35:59] <StephenLynx> >enterprise mentality ruined it
[19:36:00] <StephenLynx> lol
[19:36:29] <StephenLynx> it was not this strict enterprise mentality that caused people to over-engineer and ruin it.
[19:36:59] <StephenLynx> it was just developers being awful and being praised for being awful because they were awful while sounding professional and knowledgeable.
[19:37:44] <StephenLynx> it was caused by this culture that leads incompetent developers to get by just by throwing buzzwords and technologies and no one bats an eye that the person might not know what the fuck is doing.
[19:38:11] <StephenLynx> this is what ruins any accessible and popular technology.
[19:38:15] <StephenLynx> the same happens in java.
[19:38:19] <stickperson> i;m trying to clone a collection and get the error “not authorized on <user> to execute command <command>”
[19:38:44] <StephenLynx> this is what made PHP even worse on top of all problems it had from birth.
[19:41:22] <RWOverdijk> Question.. Like $in, is there something to do the reverse? So, if a value is an array, check if it contains "x"?
[19:41:43] <RWOverdijk> Wow that was horribly vague. Allow me to rephrase.
[19:42:12] <StephenLynx> $all?
[19:42:24] <RWOverdijk> I have documents in my mongodb database. These documents have a field called 'appliesTo', which is of type array. I want to query all documents that have value 'x' somewhere in `appliesTo`
[19:43:07] <RWOverdijk> StephenLynx, Doesn't $all require that all values match?
[19:43:15] <StephenLynx> appliestTo:{ $all : ['x']}
[19:43:31] <StephenLynx> afaik, $all requires it contains all elements you provide.
[19:43:35] <RWOverdijk> Ah the phrasing thre me off
[19:43:40] <RWOverdijk> threw*
[19:43:42] <RWOverdijk> "selects the documents where the value of a field is an array that contains all the specified elements."
[19:44:05] <RWOverdijk> So, contains all that I provided. And not exactly match what I've provided.
[19:44:08] <RWOverdijk> Thank you sir :)
[19:44:14] <StephenLynx> $elemMatch might work too, though.
[19:44:17] <RWOverdijk> I'm using this for recurring activities
[19:44:27] <StephenLynx> $elemMatch: 'x'
[19:44:29] <RWOverdijk> Storing the days an activity occurs on as an array
[19:44:38] <RWOverdijk> (like a crontab)
[19:44:50] <StephenLynx> actually, try with just
[19:44:55] <StephenLynx> appliestTo : 'x'
[19:44:55] <RWOverdijk> Ah. That does the same, but more tollerant
[19:44:58] <StephenLynx> see if it work.
[19:45:09] <mantovani> db.ComplaintsSP.aggregate([{$group:{_id : "$subject",count : {$sum : 1}} }],{$sort : {'count' : -1}},{allowDiskUse : true})
[19:45:13] <RWOverdijk> Oh I don't have the documents yet. I'd have to set up a test db real quick
[19:45:15] <mantovani> why the "sort" isn't working ?
[19:45:32] <StephenLynx> is out of the aggregation stages.
[19:45:59] <StephenLynx> it should be in the array
[19:46:23] <deathanchor> mantovani: you need to have it in the array pipeline
[19:49:53] <stickperson> how can i clone a collection from an external db that needs authentication?
[19:52:54] <deathanchor> stickperson: mongodump ?
[20:00:34] <RWOverdijk> StephenLynx, doesn't fly
[20:01:11] <RWOverdijk> Never mind
[20:01:12] <RWOverdijk> IT does
[20:01:18] <RWOverdijk> It* I made a typo.
[20:01:25] <RWOverdijk> pebkac :)
[20:26:16] <dj3000> hi. I have a bunch of inserts trickling into a collection.
[20:26:22] <dj3000> how can I stop them?
[20:26:57] <StephenLynx> what do you mean?
[20:27:02] <dj3000> basically, there seems to be a bunch of cached ("backed up") inserts forming a queue, and this data is stale. I want to clear them.
[20:28:02] <Fardin> Is there any plan for an official Go driver?
[20:28:21] <Derick> there is mgo?
[20:28:56] <Fardin> It's community driven
[20:29:05] <Derick> yeah, we don't officially support it
[20:29:10] <dj3000> StephenLynx, does what I'm saying make sense to you?
[20:29:15] <Fardin> What I'm actually looking for is a second option
[20:29:15] <Derick> but we do employ the guy that writes it
[20:29:27] <Derick> or rather, *contract* the guy that writes it
[20:29:35] <Fardin> I see
[20:29:35] <StephenLynx> it kind of does, but I am not that knowledgeable with sysadmin aspects of mongodb.
[20:29:49] <StephenLynx> I know pretty much jack outside of developer stuff.
[20:29:54] <Derick> it's in our jira: https://jira.mongodb.org/browse/MGO
[20:30:09] <dj3000> :-(
[20:31:36] <Fardin> Derick, just found what I was looking for http://docs.mongodb.org/ecosystem/drivers/community-supported-drivers/
[20:32:21] <dj3000> how long does it take to restart a mongoDB server, with about 20 GB of data?
[20:33:12] <deathanchor> dj3000: depends how many dbs
[20:33:33] <dj3000> deathanchor, about 20
[20:33:43] <deathanchor> dj3000: should be less than a minute
[20:34:04] <deathanchor> that's speaking about the mongod process only
[20:34:22] <deathanchor> if you are doing primary, always stepDown first then shutdown
[20:40:18] <dj3000> deathanchor, do you have any idea of how to clear a stale "op cache"?
[20:40:41] <deathanchor> sorry, no.
[20:42:47] <dj3000> i wonder if it's because it's in a replica set. so i delete data from the master node, and maybe the others send it old data....but that wouldn't make sense.
[20:53:23] <shlant> is it possible to have a replica set on one server? I have mongo in docker and I can't seem to get it working as it looks like having all the members with the same hostname causes problems
[20:53:59] <StephenLynx> do they have different ips?
[20:56:26] <dj3000> i think at least the port number has to be different
[20:57:48] <shlant> I have the port different on the host. Each container uses 27017 internally, but exposes 27017, 27018 and 27019 to the host
[20:58:05] <deathanchor> shlant: don't use localhost
[20:58:09] <shlant> and the container IP's are different, but I don't know what mongo uses
[20:58:13] <deathanchor> shlant: use the actually hostname
[20:58:39] <dj3000> oh yeah, localhost is bad
[20:58:59] <deathanchor> localhost, good for a single member set
[21:00:20] <shlant> I'm not using localhost, I'm using a routable hostname, but it's the hostname of the host. something like blah.node.consul:27017/27018/27019
[21:00:38] <shlant> do I need differing hostnames?
[21:00:57] <deathanchor> nope
[21:01:14] <deathanchor> that should work if you add them one at a time
[21:02:27] <shlant> I get this error when adding
[21:02:28] <shlant> Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: csm-dev.node.consul:27017; the following nodes did not respond affirmatively: csm-dev.node.consul:27018 failed with Failed attempt to connect to csm-dev.node.consul:27018; couldn't connect to server csm-dev.node.consul:27018 (172.17.5.182), connection attempt failed",
[21:02:48] <shlant> I can telnet to that address on the host
[21:03:21] <RWOverdijk> Is it possible to sort on multiple fields? So first sort on a date field, and then sort within a time field within those dates?
[21:03:38] <RWOverdijk> As in, 10:00 next day, should be grouped with 10:00 current day
[21:03:50] <RWOverdijk> They should be sorted on their own dates
[22:39:44] <topwobble> So, `db.games.count({mode: {$exists:false}})` took > 2 hours to complete on a 30M collection. `mode` was indexed however. Any thoughts on how to speed that up?
[22:40:44] <topwobble> Same query by specifying a specific value for mode is instant. I thought that mongo uses `null` as the value for undefined values in an index
[22:40:56] <StephenLynx> yeah, I heard count ops are slow