[13:20:36] <C0nundrum> in my program i want to check if an item exists using find and then add or update it using save(). How would i make it so that multiple processes don't end up adding entries between find and save ?
[13:31:50] <C0nundrum> Well a unrelated question i have is i want to write a ecomerence site and i was going to use mongodb. Hoever after hours of reading, everywhere points to the downside of mongodb not supporting ACID. And that hacking toghether a solution at the application level makes projects unmaintinable in the longrun ?
[13:33:54] <StephenLynx> if ACID is vital for your software, the effort of implementing these features might not pay off, depending on what you gain from using mongo.
[13:34:19] <StephenLynx> however, it is possible to implement these without making the software unmaintainable.
[13:35:18] <StephenLynx> there are tools that helps to keep atomicity without having actual ACID
[13:35:48] <StephenLynx> or bulkwrite, which enables you to rollback changes in a single operation.
[13:36:07] <StephenLynx> if you have to rollback several documents
[13:37:01] <StephenLynx> IMO, unless you REALLY know what you would gain from mongo and you have enough experience with the platform you are using (node.js, right?) I wouldn't use mongo.
[13:37:27] <StephenLynx> otherwise you might end up writing spaghetti code trying to compensate the missing features you need.
[13:39:28] <C0nundrum> what would you recommend then for a a ecomernece site that doesn't really have bigData requirements but supports easy horizontal scaling. Thinking of deploying it on heroku
[13:40:45] <StephenLynx> the horizontal scaling might not be as good as mongo's
[13:40:52] <StephenLynx> but I don't think it would be too much of an issue
[13:44:01] <StephenLynx> that kind of stuff doesn't cause legacy nor technical debt.
[13:44:06] <C0nundrum> Hm i will look into it. So about findandmodify the problem with that is that i don't want to waste resource populating and object before calling it is the a way atomize the findandmodify ?
[13:55:52] <StephenLynx> yes, that is what upsert is for.
[13:56:02] <StephenLynx> it populates for you if it doesnt exist.
[13:58:42] <C0nundrum> i mean on the appliaction level if i have 5 queries that run at the same time to check if an entry exists need only 1 to pass. At that point it will then do some intenstive tasks before it know what to set in the database. the calling findmondify twice be the correct option that way only on will pass the upsert ?
[15:06:12] <C0nundrum> StephenLynx, do you know and good mongo db Admin Uis ? I like Mongo Mangement Studio atm but would be nice to have one with built in anylytics thats user friendly.
[15:06:39] <StephenLynx> no, I just use the terminal.
[16:16:02] <C0nundrum> how would i query a dubdocument
[16:16:19] <C0nundrum> WHen i do query it still returns the parent document
[16:16:32] <StephenLynx> yes, you have to fetch the document.
[16:16:37] <StephenLynx> and from it read the sub-document.
[17:27:02] <StephenLynx> because it seems that if you provide it with something that is not an ObjectID, it doesn't do anything of the special behaviours
[17:38:26] <C0nundrum> if i use that object as part of a aggreation query
[17:38:53] <C0nundrum> {"errormessage":"Mongo Error: exception: Error: command failed: {\n\t\"errmsg\" : \"exception: FieldPath field names may not start with '$'.\",\n\t\"code\" : 16410,\n\t\"ok\" : 0\n} : aggregate failed\n at Error (<anonymous>)\n at doassert (src/mongo/shell/assert.js:11:14)\n at Function.assert.commandWorked
[17:40:56] <C0nundrum> ah i see it the correction didn't work because i was still using project
[17:47:10] <GothAlice> StephenLynx: I'm evaluating 3.2 + WT today. So far things are looking promising; restore of a stock data template took 1/10th as long as expected.
[18:03:32] <C0nundrum> what query would i use to check the difference between now and the date stored ?
[18:05:11] <StephenLynx> not sure that is possible.
[18:05:57] <StephenLynx> you can use arithmetic operators though
[18:07:32] <GothAlice> The question doesn't really make sense.
[18:08:05] <GothAlice> If you have data in hand (i.e. a variable in your code), and data in MongoDB, you'll have to use your language's available tools to perform the calculation of difference. (I.e. difflib in Python.)
[18:08:13] <GothAlice> MongoDB can't really help you with that.
[18:09:26] <GothAlice> On the other hand, there are ways to structure how you store your data, and how you store updates to your data, that preserve the history, but that's still you, not MongoDB, helping you out.
[18:09:43] <C0nundrum> Also looking at the docs select the difference using db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ new Date(), "$date" ] } } } ] )
[18:11:48] <GothAlice> Ah, scroll up a bit. Wrong anchor, sorry.
[18:12:57] <GothAlice> If you mark any fields for inclusion (1), it implies that non-marked fields aren't included. Simply remove your "item: 1" part of the projection to get all fields back, plus the one added as dateDifference. But this is a serious case of XY problem solving.
[18:13:04] <C0nundrum> explicitly define them is mandatory :(
[18:42:57] <GothAlice> StephenLynx: https://soundcloud.com/gothalice/metal-crusher?in=gothalice/sets/undertale ;) Now to explore the data storage differences. I'll be setting up a new production cluster next week, and I think I'll give WT a shot on it.
[19:15:51] <StephenLynx> GothAlice you know any condition where mongo would change the _id of a document for no good reason?
[19:15:59] <StephenLynx> I am 100% certain I a not editing the document _id
[19:16:04] <GothAlice> I know of none. Once set, AFIK internally it's immutable.
[19:18:27] <StephenLynx> ok, nvm v: the id is not changing
[20:10:14] <m3t4lukas> hey guys, I just installed kernel 4.2.0-19 on my MSI GE60 Notebook. Now wifi is not working anymore :/ rfkill shows only my bluetooth adapter and lshw shows an unclaimed Intel Wireless 3160 controller. Any ideas what my options are?