PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 15th of February, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:26] <kurushiyama> Freman: if it is for development... ...well, sure. Why not? If it helps, you can have a second person type in the query after reviewing it. Will it help with existing indices which lack a field for sorting, for example?
[00:00:48] <kurushiyama> Freman: I prefer good ol' handywork.
[00:02:42] <Freman> tbh I'm making it up as I go along, they break it I find out how and fix it. it really just checks to see if the first field in the query is a first field in any index. doesn't stop them from putting in 1970-01-01 as a date but it is stoping me from getting woken up at 2 am because they crashed/cancelled out on a bung query on the wrong collection (one that doesn't even have the field their looking for)
[00:04:29] <kurushiyama> Freman: provide them with dev instances. And have profiling enabled with 75ms slow queries. Have them read them manually using the shell. ;)
[00:05:19] <Freman> wish I could, but they're querying production log data (which is a stupid amount of logging - why log the error for a request and a reference when when we can log the entire 8k request and html error page)
[00:05:47] <kurushiyama> Freman: Holy cow.
[00:06:47] <Freman> yeh and their bung queries stall mongo and cause my logging engine (which I had to write because they swamped whatever was there before) to backlog (it was designed to do that)
[00:07:16] <Freman> I'm trying to negotiate the moving of audit type logs to a dedicated collection and everything else into a capped collection with disk copy (and logrotate)
[00:07:34] <Freman> will make the whole thing more sane (and is something I can easily code :D)
[00:08:14] <kurushiyama> Freman: Erm... ...kill me, but rsyslog + logrotate does not do it?
[00:08:27] <kurushiyama> Freman: and grep... ?
[00:09:00] <Freman> all of this is to facilitate a real time log ui (a webpage with a socket that I could also just as easily pipe to from the re-written logging engine)
[00:10:23] <Freman> so yes, rsyslog + logrotate + capped collection should do everything they want from the real time logging view and audit collection for things that probably shouldn't just be dumped into the same place as "your request failed, here's 8k of rubbish no-one wille ver read"
[00:12:09] <kurushiyama> jiffe: I dont see a possibility not to resync
[00:12:18] <Freman> I am aware that we're crap, I'm trying to fix it
[00:12:38] <kurushiyama> jiffe: Hope you have another secondary running...
[00:13:20] <kurushiyama> Freman: send them by mail do the dev maling list... ;P
[00:13:48] <Freman> it's funny you should say that kurushiyama :D
[00:14:47] <Freman> From our logging wiki page (which I wrote when I had to re-write the logging engine to deal with the load) "We log everything, sometimes even logging that we've logged logs, and because of the quantity of logs, sometimes we even email that we've logged it."
[00:14:48] <kurushiyama> Freman: Bamoboo +Stash = Painless integration.
[00:15:24] <kurushiyama> Freman: if you send every incident, maybe the devs notice that they overdo it... ;)
[00:15:28] <Freman> Yeh apparently, I'm stuck with more the making things build getting agents working (holy cow they're expensive - I come from jenkins where they're all 'free')
[00:15:58] <kurushiyama> Freman: That's a bit comparing apples with pears.
[00:16:13] <Freman> apples with pears that are hammers that make everything look like nails
[00:16:16] <kurushiyama> Freman: what you actually pay for is the integration, imho.
[00:16:26] <kurushiyama> Freman: That was a good one!
[00:17:52] <Freman> I don't know about integration I'm still doing all the same things I was doing under jenkins to get the builds working... but instead of having containers with an agent for each type of job that can be spun up and down as load dictates I now have containers per agent... that I've yet to figure out. but that's a bit off topic for #mongodb
[00:18:20] <kurushiyama> Freman: right. So, need to hit the hay.
[00:18:27] <Freman> sleep well
[00:49:18] <jiffe> well this secondary thinks its last optime is 56c0be5f:5 and minvalid is 56c0be65:15, can I somehow change last optime to 56c0be65:15 on the secondary?
[00:49:54] <joannac> ...what? no
[00:50:26] <jiffe> joannac: I can't just skip ops?
[00:50:38] <joannac> jiffe: no you cannot just skip ops
[00:50:48] <joannac> unless you want to just lose data
[00:50:54] <jiffe> joannac: that's the point
[00:50:58] <joannac> why?
[00:51:11] <jiffe> this is just a backup so I don't need every single document to be present
[00:51:46] <jiffe> if it saves me a week of resyncing then its worth it to just skip a few ops to me
[00:53:27] <joannac> a week?
[00:53:45] <jiffe> yes these shards are about 26TB
[00:54:03] <joannac> and the shard has fallen off the oplog?
[00:54:10] <joannac> how large is your oplog?
[00:54:14] <jiffe> it shouldn't have
[00:54:42] <joannac> then it should just catch up.
[00:54:52] <jiffe> the actual message is replSet need to rollback, but in inconsistent state; minvalid: 56c0be65:15 our last optime: 56c0be5f:5
[00:55:25] <joannac> sigh
[00:55:30] <joannac> non-majority write concern?
[00:58:32] <jiffe> well right now 2 of the 3 nodes were running when this killed the other secondary
[00:58:56] <jiffe> or at least it doesn't start now giving this message
[00:59:16] <joannac> backup and restore from one of the other nodes
[00:59:46] <joannac> or just restore from a recent backup
[01:00:20] <joannac> there is no safe way to skip operations
[01:00:34] <jiffe> gravy
[04:15:50] <DocMerlin> Hello, how do I find out what my shard key is?
[04:16:38] <DocMerlin> I have a rather large (2TB) sharded collection and I need to find out what the shard key is to speed up some queries.
[04:30:40] <Freman> don't suppose anyone knows how mongo does their videos, that thing with the hand writing on a whiteboard, that's actually pretty cool
[07:49:37] <Zelest> Is it possible to use $addToSet and only check if some of the element exists? E.g, if I have an array with objects.. [{a: 1, b: 'foo'}, {a: 2, b: 'bar'}] .. I wish to update and add a object with a: 1, but only if it doesn't exists and it shouldn't add another one even if b: is something different than 'foo' .. Is this possible
[07:49:45] <Zelest> ?
[08:46:35] <sabrehagen> how do i restructure this logic using a query to reduce my number of database accesses? i have a query that returns documents in a certain time range. each document has a device id. for each of those documents i want to see if there is a document matching
[08:46:44] <sabrehagen> that device id in the 10 seconds prior. the initial number of documents can be 40,000+. my logic then sends 40,000 database queries to check the second piece of criteria.
[08:46:49] <sabrehagen> without the aggregation framework, how would i minimise the number of queries?
[09:32:08] <kurushiyama> sabrehagen: Sounds like there is something fundamentally wrong with your data model.
[09:36:18] <Lachezar> Hey all. What's the "MongoDB Way" of doing searches of documents by properties in related documents? Let's say an db.Order(id) has reference to db.Customer(id, name) and to a db.Employee(id, name). How should I do the model? I want to be able to search orders by text (quick-search) using the name of the customer OR employee?
[09:39:17] <kurushiyama> Lachezar: IN general, that is a relation with attributes: The Order relates the Customer to the Employee, but is itself qualified by attributes.
[09:40:08] <Lachezar> kurushiyama: I did not understand that. How is Order "qualified"?
[09:40:15] <kurushiyama> Lachezar: I would have an additional field in the order with the customers and employees name,
[09:40:38] <kurushiyama> lachezar: It isnt a "simple" relation, but on that has attributes itself.
[09:40:45] <Lachezar> kurushiyama: Ah. And how would I keep them in sync?
[09:40:53] <kurushiyama> Lachezar: erm...
[09:41:13] <kurushiyama> Lachezar: if you change a employee, you change the acccording orders?
[09:42:00] <kurushiyama> db.orders.update({employee:"Foo"},{$set{employee:"bar}},{multi:true})
[09:42:40] <kurushiyama> Referential integrity is so 90s. Nad SQLish ;)
[09:42:41] <Lachezar> kurushiyama: Hm. Well... Yes. That might work with the simple pointer relations. But I understand where this i sgoing.
[09:42:57] <kurushiyama> Lachezar: They arent automatic, either.
[09:43:17] <kurushiyama> Lachezar: A text search via DBRef is not possible.
[09:44:04] <kurushiyama> Lachezar: Data modelling with mongodb involves redundancy. The earlier you get used to it, the better you models will become.
[09:46:30] <Lachezar> kurushiyama: redundancy… That word is badly used here. Redundancy (in IT) is typically meant to provide a measure of stability, failure tolerance and coping with critical events while possibly reducing performance. What you describe seems uite the opposite.
[09:47:46] <Lachezar> kurushiyama: Thank you for the time. I'm going to say that searches in MongoDB come at a price.
[09:48:13] <kurushiyama> Lachezar: I am in the industry for like 20 and a bit and have done huge projects with MongoDB. MongoDB is not just the cooler MySQL. You _really_ need to rethink the way you model data.
[09:48:36] <kurushiyama> Lachezar: http://blog.mahlberg.io/blog/2015/11/05/data-modelling-for-mongodb/
[09:48:59] <kurushiyama> Lachezar: Will try to issue the next post these days.
[09:52:09] <kurushiyama> Lachezar: To put it a bit simplified: You model data according to your questions, not according to the entities.
[10:18:47] <sabrehagen> kurushiyama: would be interested in reading part 2 of that blog
[10:19:42] <kurushiyama> sabrehagen: Well. It is a side project (sadly), and I first have to feed the family. If you have things that especially interest you, please add it in the comments.
[10:19:57] <kurushiyama> sabrehagen: But I'll do my very best.
[13:51:10] <Ben_1> is there a difference between bulkWrite and insertMany?
[14:14:13] <Zelest> I remember when people used to speak in here :
[14:14:14] <Zelest> :S
[14:14:37] <StephenLynx> lurk moar
[14:26:17] <Ben_1> Zelest: you could speak and answer my question :P
[14:26:20] <Ben_1> is there a difference between bulkWrite and insertMany?
[14:26:42] <Zelest> Hehe, if I knew the answer I'd help you mate :)
[14:27:56] <kurushiyama> Ben_1: insertMany is equivalent to bulkWrite insertOne
[14:28:07] <kurushiyama> Well, many of them, obviously
[14:28:54] <kurushiyama> Ben_1: bulkWrite is more flexible, however, since you can mix inserts, updates and alike.
[14:29:22] <Ben_1> ah ok, but I just want to insert data so insertMany will be fine
[14:29:25] <Ben_1> thanks kurushiyama
[14:30:01] <kurushiyama> Ben_1: Yes. Be aware though that you may cause duplicate key errors. I tend to use bulkWrite with upserts.
[14:32:31] <kurushiyama> Zelest: Many users seem to prefer SO for c&p development. ;)
[14:35:40] <Zelest> SO? c&p? :o
[14:37:26] <kurushiyama> Zelest: _S_tack_O_verflow, Copy & Paste
[14:37:51] <kurushiyama> Freman: How did it turn out? ;)
[14:40:12] <Zelest> Ah
[14:43:25] <kurushiyama> Zelest: Yup. Got warned today for telling someone (in much nicer words) that he can *piep* himself and do his *piep* work himself. Wanted a complete business logic for a booking website.
[14:43:54] <Zelest> Haha
[14:44:50] <Zelest> ugh, I find arrays in mongo messy :S
[14:44:58] <Zelest> or well, update various parts of an array and such is messy
[14:46:00] <kurushiyama> Zelest: How that?
[14:47:18] <Zelest> e.g, if I have a document {_id: ObjectID(...), a: "foo", b: [{foo: 'a', bar: 'b'}, {foo: 'b', bar: 'a'}]}
[14:47:39] <Zelest> i can use slice to fetch the whole document but only the first element of b
[14:48:05] <Zelest> if I wish to save that later on, I can use b.$ for example
[14:48:22] <Zelest> but if I want to upsert a sub-document to b.. it becomes trickier
[14:48:30] <kurushiyama> Zelest: Thats not true
[14:48:35] <Zelest> oh?
[14:48:45] <Zelest> i wish to avoid fetching the whole b for the document
[14:48:51] <kurushiyama> Zelest: first, you can use $elemMatch in projection to get the macthing array member
[14:49:01] <kurushiyama> Zelest: mom
[14:49:11] <Zelest> mom? :o
[14:50:02] <kurushiyama> Zelest: MOMent, please. ;)
[14:50:07] <kurushiyama> Zelest: http://stackoverflow.com/q/35407758/1296707
[14:50:07] <Zelest> oh, sure :)
[14:50:59] <Zelest> yeah, slice works as well for me.. no issues there
[14:51:12] <Zelest> (seeing i sort it beforehand, so the first element is always the one I want)
[14:51:33] <Zelest> but it's the upsert part i find messy
[14:51:52] <Zelest> I basically want to use a $addToSet, but have it check only one sub-element.. if that makes sense
[14:52:18] <kurushiyama> Zelest: using $elemMatch is cheaper, iirc. Well, in that use case, I'd fetch the whole array and push it. But I think it is rather a modelling problem.
[14:52:45] <kurushiyama> If arrays need to be updated fairly often, from my experience, you might be better of with a collection.
[14:54:00] <Zelest> yeah, might be..
[14:54:22] <Zelest> it's tricky though, seeing i need the parent-document/collection updated as well then
[14:54:28] <Zelest> I'm building a crawler
[14:54:37] <Zelest> and I have a domain per document
[14:54:44] <Zelest> and the sub-document are paths
[14:54:47] <Zelest> e.g, pages
[14:55:10] <kurushiyama> Zelest: That's not going to work for say wikipedia.
[14:55:34] <kurushiyama> Zelest: you are going to hit the BSON size limit.
[14:55:38] <Zelest> hmms
[14:56:03] <Zelest> sure about that? (I only save the path, date, etc.. no actual data)
[14:56:23] <kurushiyama> Well, you impose an artificial limit
[14:56:41] <Zelest> true
[14:56:49] <kurushiyama> If you have a site collection and a pages collection, you can simply insert a new doc into pages.
[14:56:59] <Zelest> well
[14:57:00] <kurushiyama> And usually, you want the pages for a _given_ site
[14:57:01] <Zelest> my main issue is
[14:57:10] <Zelest> I don't want to crawl the same domain more than once every 10 second
[14:57:27] <Zelest> so I have a accessed field on the domain.. and use a $lte for that
[14:58:10] <Zelest> actually.. you might be right..
[14:58:16] <Zelest> i just do more queries
[14:58:28] <kurushiyama> if db.pages.find({site:"foo.com"}).sort({date:-1}).limit(1) newerThan(-10s) { skip }
[14:59:08] <kurushiyama> if db.pages.find({site:"foo.com"},{date:1}).sort({date:-1}).limit(1) newerThan(-10s) { skip }
[14:59:21] <Zelest> won't solve it
[14:59:27] <kurushiyama> (limiting the bytes to return, and with an index, you should have a covered query)
[14:59:40] <Zelest> or.. hmms
[14:59:45] <kurushiyama> Zelest: But you get the picture ;)
[14:59:58] <Zelest> i will first have to fetch the domain/site
[15:00:04] <kurushiyama> Sure.
[15:00:05] <Zelest> and go for the pages afterwards
[15:00:12] <kurushiyama> Well... yes.
[15:00:18] <kurushiyama> So?
[15:00:40] <Zelest> yeah, maybe..
[15:01:03] <kurushiyama> Zelest: http://blog.mahlberg.io/blog/2015/11/05/data-modelling-for-mongodb/
[15:01:15] <kurushiyama> ;)
[15:01:38] <Zelest> cheers :D
[15:34:50] <Ben_1> is there a way to bulk insert in multiple collections
[15:34:52] <Ben_1> ?
[15:35:04] <Zelest> I have no idea, but I doubt it
[16:00:54] <kurushiyama> Ben_1: Aside of having concurrent bulk operations implemented by your application: nope.
[16:01:41] <Ben_1> kurushiyama: thx, I'm using the async binding so I think it's enough to start multiple bulk inserts one after another
[16:02:07] <kurushiyama> Ben_1: JS?
[16:09:24] <Ben_1> kurushiyama: what do you mean by "JS" ?
[16:10:56] <kurushiyama> Ben_1: JavaScript
[16:11:01] <Ben_1> ahh, no in java
[16:12:16] <kurushiyama> Ben_1: Ok. that should do it, then.
[16:28:31] <StephenLynx> damn it. where do you install commands for a single user?
[16:28:33] <StephenLynx> I forgot it.
[16:29:08] <CustosLimen> hi
[16:29:17] <StephenLynx> nvm, I used .bin instead of just bin :v
[16:29:18] <StephenLynx> hurr
[16:29:19] <CustosLimen> can I access mongo config values (like port) from mongo shell ?
[16:29:28] <Ange7> hey all
[16:30:05] <Ange7> is it possible to modify default timeout for aggregate() in mongo configuration file ? cause timeout() function in php driver doesn't work for me ?
[16:31:02] <Derick> Ange7: which timeout?
[16:31:36] <Ange7> Cursor
[16:31:43] <Derick> server side? client side? cursor? What's your (simplified) code? What's the full error you get with the timeouts? And what does "timeout() doesn't work" mean?
[16:32:00] <Derick> Also, which driver? Which version of the driver?
[16:32:28] <Ange7> ok Derick, waiting
[16:35:21] <Ange7> Derick: http://pastebin.com/CEbTHnFQ
[16:36:26] <Derick> mongo 1.6.12 stable
[16:36:26] <Derick> mongodb 1.1.2 stable
[16:36:32] <Derick> why do you have both?
[16:36:46] <Ange7> don't know ?
[16:36:55] <Derick> that's not a good answer
[16:37:16] <Derick> your code seems to use the old mongo driver, and not the new mongodb one
[16:37:19] <Ange7> i think cause i have php5-mongo installed from debian repository
[16:37:36] <Derick> but this code does not show timeout() being used.
[16:37:58] <Ange7> p php5-mongo : not installed
[16:39:20] <Ange7> ok i removed mongodb 1.1.12
[16:42:08] <Ange7> but same problem
[16:42:24] <Ange7> $collection->timeout(60000);
[16:42:35] <Ange7> but Read timed out after reading 0 bytes, waited for 30.000000 seconds'
[17:49:53] <choro> how do i allow for remote connections? i want to use robomongo on my personal machine to access the mongo database on my server
[17:50:21] <StephenLynx> go to /etc
[17:50:27] <StephenLynx> do a ls | grep mongo
[17:50:34] <StephenLynx> I think the file is named mongo.conf
[17:50:51] <choro> i have mongod.conf and mongodb.conf
[17:51:00] <StephenLynx> hm
[17:51:02] <StephenLynx> try mongod.conf
[17:51:05] <StephenLynx> Im not sure
[17:51:13] <choro> alright, yeah that seems like the best option
[17:51:17] <StephenLynx> HOWEVER
[17:51:22] <StephenLynx> remember to enable authentication
[17:51:33] <choro> how do i do that?
[17:51:39] <StephenLynx> can't remember.
[17:51:49] <choro> alright, that's cool, ill look it up
[17:51:49] <StephenLynx> I just don't allow remote connection on servers
[17:51:50] <choro> thanks!
[17:51:53] <choro> ah, yeah
[18:33:21] <SAiF> can anyone give me a working link for mongochef 3.4.0 windows 64 for non commercial use..
[18:33:52] <SAiF> I cant download it from official site. It just wont download. I am not sure if its my end causing problems
[18:37:34] <SAiF> oops. sorry. It was my download manager stopping the download. I got it , Thanks
[18:39:15] <cheeser> i hope that's mongochef that's saying 3.4 and not the mongo version. :)
[18:40:04] <StephenLynx> >windows
[18:40:14] <StephenLynx> shiggidy diggity mah niggy
[18:43:22] <Ben_1> MongoCollection<Document> collection = database.getCollection(collectionKey); <<< in java this line should be enough to create a collection, but robomongo says there is no collection. could something go wrong by creating a collection? and what happens if I create a collection but do not insert something?
[18:46:15] <Ben_1> after this line the collection variable is not null
[18:51:18] <Ben_1> ok it seems my singleResultCallBack is not called so I think something wents wrong by using insertMany
[19:14:46] <Ben_1> someone using the async driver too?
[19:19:45] <cheeser> that line will not createa collection
[19:20:14] <cheeser> not in the db anyway. you'll get a MongoCollection reference but that doesn't mean it's backed by anything yet.
[19:21:09] <Ben_1> yah but when I insertMany in that reference it should be created, or not?
[19:21:22] <cheeser> yes
[19:21:31] <cheeser> any write to the collection will create it in the db.
[19:22:23] <Ben_1> and that's my problem, the line after that getCollection I have a insertMany and that instruction won't work
[19:22:44] <cheeser> doesn't work how? pastebin your code.
[19:22:45] <Ben_1> cheeser: collection.insertMany(listOfDocuments, insertResponse);
[19:23:13] <Ben_1> listOfDocuments is a List<Document> with 1500 entries
[19:23:27] <Ben_1> insertResponse is the callback
[19:25:32] <Ben_1> cheeser: well, the callback is not called, so internally something goes wrong I think
[19:25:56] <cheeser> how are you testing that?
[19:29:10] <Ben_1> cheeser: I have system.out.println inside of my callback
[19:30:50] <cheeser> and you wait how long to see that?
[19:32:06] <Ben_1> 4 minutes from last time
[19:32:52] <Ben_1> but anyway I'm using Robomongo GUI to look inside my database and it shows the database but no collections.
[19:33:47] <cheeser> strange. i haven't used the async driver so i'm not sure what else might be off.
[19:34:28] <Ben_1> found several tutorials but all are providing the same code that I use
[19:36:54] <Ben_1> cheeser: mh it seems in the log file no command is executed. Creating the database programmatically will work but the insertMany not
[19:36:58] <Ben_1> Let me try insertOne
[19:43:10] <Ben_1> mh does not work anyway
[19:46:33] <Ben_1> using 3.2.1 async driver, I will try 3.2.2
[19:58:23] <Ben_1> cheeser: ok, seems robomongo is broken somehow
[19:58:38] <Ben_1> cheeser: thought it will work with mongoDB 3.2 but it won't show any collection
[19:58:51] <Ben_1> now I use the shell and it shows all the content
[20:02:24] <Ben_1> and mongoDB can't handle collections in shell which starts with a number
[20:18:38] <cheeser> not entirely true but he's gone
[20:22:29] <kurushiyama> cheeser: In which way?
[20:42:51] <cheeser> db.getCollection("123") <-- works
[20:43:34] <Derick> try it with a ß in it!
[20:44:18] <cheeser> works!
[20:44:19] <cheeser> :)
[20:47:21] <kurushiyama> cheeser: ah, ok. Still do not see the need. Whenever I see numbers in collection names, I actually read "modelling problems"
[20:48:15] <cheeser> kurushiyama: i completely agree. :)
[20:48:34] <cheeser> it's the jurassic park problem.
[20:49:09] <Derick> the what?
[20:49:52] <cheeser> jurassic park. "they spent so much time to wondering if they *could* do something they never stopped to wonder if they *should*"
[20:53:27] <kurushiyama> cheeser: That pretty much subsumizes every SO question about MongoDB I have seen in the last half year (which wasnt a "do my (home)work" or "I dont want to read the docs, I rather ask here").
[20:53:39] <cheeser> pretty much
[20:53:46] <cheeser> read the docs is for chumps
[21:03:03] <jackz> Hi
[21:03:44] <jackz> People, I need a little help about modeling
[21:04:38] <jackz> I have two entities, articles and users
[21:06:30] <jackz> What dp you suggest me to register who user like my article?
[21:06:48] <jackz> *users
[21:08:18] <jackz> Article has title, text and likes
[21:10:06] <jackz> User has nickname, birthday, email,...
[21:11:24] <cheeser> if a use likes an article, add her ID to the list of likes on the article document
[21:12:56] <kurushiyama> cheeser: I dont think so.
[21:13:09] <kurushiyama> That would impose an artificial limit on likes.
[21:13:27] <kurushiyama> Plus potentially cause document migrations on mmapv1
[21:13:42] <cheeser> yeah, there are few shortcomings but it's the simplest solution that'll work for most sites.
[21:13:46] <kurushiyama> Have an article collection, have a post collection and a like collection
[21:14:06] <jackz> Ok. I just know relational database and put ID like foreign key is strange.
[21:14:42] <kurushiyama> Since the questions usually are simple: How many likes does a _given_ post have: db.likes.find({'postid': someiD}).count()
[21:15:04] <kurushiyama> jackz: it isnt.
[21:15:23] <kurushiyama> embedding only works for one-to-(very)-few relations.
[21:15:46] <cheeser> kurushiyama: that'd be ok-ish if you also tracked like count on the article itself.
[21:16:02] <kurushiyama> cheeser: why should you?
[21:16:04] <cheeser> personally, i'd probably go with something along those lines
[21:16:12] <cheeser> kurushiyama: one fetch to display the article
[21:16:29] <kurushiyama> cheeser: yeah, with an imposed limit, and huge data to be retrieved.
[21:16:44] <cheeser> no, i mean, i'd use the "likes" collection like you suggested.
[21:16:54] <cheeser> *mine* was just the easiest way to get something up and running.
[21:17:18] <kurushiyama> cheeser: sort of.
[21:17:24] <cheeser> but having worked on a CMS at scale, i'm aware of the various limitations in that approach. they're just not likely to apply to someone asking in iRC at this point ;)
[21:17:25] <jackz> Ok. I understud
[21:18:30] <kurushiyama> cheeser: Well, and now the app becomes the next best thing and the OP sends his gorillas to kick you in the but for suggesting a data model which does not scale well ;)
[21:19:23] <cheeser> kurushiyama: when that happens, i'll happily take the heat. but it's not gonna. :)
[21:19:40] <cheeser> and for someone trying to learn mongodb, those are complications they needn't worry about just yet.
[21:21:31] <kurushiyama> cheeser: I see this quite different. The sooner people start to get used to redundancy and to model their data according to their questions as opposed to modelling according to their entities, the better for all of us.
[21:22:23] <cheeser> yes and no.
[21:25:36] <kurushiyama> cheeser: Could you clarify your thoughts to me? I am really curious...
[21:27:19] <cheeser> well, part of my job is to help people get started. in this case, it feels more like an exploratory "what is mongo?" project. had it been, "we're migrating our customer service systems to mongo" it'd warrant a different response.
[21:27:50] <cheeser> when someone asks me how to get started building a website, i don't start by discussing scaling issues faced by facebook and twitter.
[21:28:52] <kurushiyama> cheeser: Well, Adam taught me this approach ;)
[21:29:40] <kurushiyama> cheeser: iirc... ;)
[21:40:47] <cheeser> adam?
[21:43:47] <kurushiyama> cheeser: Adam Comerford, used to be instructor at MongoU
[21:45:29] <cheeser> ah. yeah. well your suggestion and how i'd actually do it only differ in that i'd keep a count on the article documents, too.
[21:47:11] <kurushiyama> cheeser: I'd rather use an aggregation for it than to store it manually. But granted, that may be just me. And granted, our solutions differ more on a philosophical level than a technical level.
[21:47:51] <cheeser> you'd pay that cost everytime you need the count?
[21:48:13] <cheeser> which would be, for many websites, every time the article is rendered?
[21:51:10] <kurushiyama> cheeser: An aggregation can have a match phase, and doing an aggregation is more reliable than doing a .count(), but still less harder to keep in check than updating a post document every time a like is added. There is an interesting problem related to doing counts in a sharded env: https://jira.mongodb.org/browse/SERVER-3645
[21:51:29] <kurushiyama> cheeser: reads are cheap, after all.
[21:52:51] <cheeser> cheaper still to just stick that count on the article ;)
[21:56:24] <kurushiyama> Well, probably I'd do an $inc on a counter, if the application really takes off. With document level locking, it does not hurt so much any more.
[22:44:03] <synapse> I am trying to build a function in nodejs like this searchUsers(query) which passes query to this db.collection.find(query) but it's proving difficult. escaping characters seems like a bad thing to do to get a literal query so what's "the right way"
[22:56:09] <StephenLynx> which characters you want to escape?
[22:56:33] <StephenLynx> what exactly is your problem, synapse ?
[23:05:25] <synapse> I've solved it but do I need to escape anything StephenLynx
[23:06:06] <synapse> find({ "name": variable }); where variable is passed as a parameter
[23:06:12] <synapse> can it be dangerous