[01:05:10] <Gevox_> joannac> : Btw, the method i just showed always returns false although the object exists in the DB. Do you see anything wrong related to it?
[01:06:22] <joannac> yes, I don't understand the logic
[01:07:13] <joannac> please explain how your code achieves what you want
[01:07:21] <joannac> try it out in the mongo shell
[03:13:40] <dunkel2> im new trying to use mongodb, i willl install it but i see i have two options with and without openssl, which one should i use, my webapp domain will be ssl, should i install it then with ssl?
[03:14:02] <dunkel2> or that ssl is for a direct url to connect to the mongodb itself?
[03:50:21] <Kaylors> How would you denormalize a complex mongodb document using mongoose? For example I have a document with multiple arrays of subdocuments that in have references in them that need to be populated during a read of the parent document.
[03:56:14] <arussel> I've tried to restart my mongo instance using '/etc/init.d/mongod restart', but start failed. So now I'm trying 'mongo -f myconfile', but I get:
[03:56:31] <arussel> RROR: child process failed, exited with error number 1
[04:37:15] <arussel> when I start with -f and fork=true, I get the error: 'Cannot write pid file to /var/run/mongodb/mongod.pid'. Considering the dir belongs to mongod, I'm assuming that fork is not running as mongod. Is there an option to make run fork as a user ?
[04:41:10] <arussel> my problem seems very close to: http://stackoverflow.com/questions/23086655/mongodb-service-will-not-start-after-initial-setup
[04:44:52] <arussel> I really don't understand, I get the error: ERROR: Cannot write pid file to /var/run/mongodb/mongod.pid: Success, but when I check, the file was created
[04:55:58] <arussel> and this has nothing to do with the directory, as changign the dir to /tmp gives the same error
[05:01:22] <arussel> removing the pidfilepath from my config file fixes the problem
[05:02:22] <arussel> joannac: thanks for your help this was helpful to find the root of the problem
[06:00:38] <Kaylors> How would you denormalize a complex mongodb document using mongoose? For example I have a document with multiple arrays of subdocuments that in have references in them that need to be populated during a read of the parent document.
[06:11:52] <joannac> I'm not sure what mongoose has to do with this though
[06:13:33] <Kaylors> joannac: I'm using mongoose as my ODM.
[06:17:05] <joannac> Kaylors: that doesn't really answer my question. Why do you think you need to "use Mongoose" to denormalise?
[06:17:33] <joannac> what's your definition of "denormalise"?
[06:23:24] <Kaylors> joannac: As in, that was my assumption that you'd need to do it at the ODM level. If it can be done by base mongodb queries, I'd be okay with that. I guess I might be using denormalize wrongly. What I want is for every reference in every part of the document to be populated.
[09:49:35] <leporello> Hi. I want to create tree with categories as leafs and subcategories as nodes. How can i do it if mongoose schema can only have regular structure?
[09:50:40] <leporello> So it's about storing different schemas in one collection.
[10:23:32] <Kota> here's an interesting conundrum for you guys... i've been having issues lately with how long its been taking for my application to retrieve messages from mongo. i've been systematically going through all the possible bottlenecks, and have concluded that str() is a bottleneck.
[10:24:10] <Kota> the query itself takes around 12ms, and preparing that stuff into a dictionary takes probably less time
[10:24:35] <Kota> so i decided to test this in my loop, by simply printing the stringified oids to the console
[10:24:48] <Kota> it took 4.8 seconds to convert 30 object ids into strings
[10:25:50] <Kota> i haven't even changed this function for a long time, it used to return in around .3 seconds, but one day it started getting randomly longer
[10:26:18] <Kota> it was up to around 10 seconds, to execute, and I cannot explain why turning objectids into strings would be so dynamically time consuming
[10:55:38] <Kota> well that's a heisenbug wtf... I copied my code around, did tests individually, and when i reverted the code its back to taking 60ms
[11:43:06] <leporello> Hi again. How can i create document inside of static method? I use model = this, then this.create({some: property}) and then nothing. Collection is empty.
[12:02:53] <arussel> is there a way to setup a single node replica set in the config file of that node ?
[12:03:21] <arussel> I'm starting the instance on aws and don't want to have to connect to the server to set the config
[14:04:02] <derbie> So if i am going to have a collection `users` with attributes ( email, password, role ) and another collection `drivers` with attributes ( licenseid , ssn } how should i relate the two?
[14:04:32] <derbie> Should i add an id field in the users schema and create a foreign key rule for drivers in the code?
[14:04:48] <derbie> I am coming from mysql as you can probably tell
[14:29:37] <synthotronic> "To upgrade an existing MongoDB deployment to 3.0, you must be running 2.6" - why, what happens if you upgrade to 3.0 from 2.2?
[14:32:37] <cheeser> there are certain upgrades that get applied at each step
[14:32:48] <cheeser> index formats/optimizations, etc.
[14:34:34] <synthotronic> So you will break the database? Bit worrying then that the CentOS packages give you the option to upgrade directly from 2.2 to 3.0.
[14:36:12] <cheeser> centos has no notion of the upgrade needs of any of its packages so you can skip versions on any package you want. centos doesn't know or care.
[14:40:44] <synthotronic> The mongodb.org packages for CentOS I mean, not the ones provided by CentOS.
[14:58:05] <oznt> How can I use the command copydb? I have added a user with the following roles: [ {role: "dbOwner", db: "company"} , {role: "dbAdmin", db: "company"}, { role: "read", db:"company", collection: "system.namespaces" } ], but mongodb is still complaining "not authorized for query on audible.system.indexes.namespaces"
[16:12:23] <benben421> Hi, i'm trying to implement a "version_number" property in a document that would be atomically incremented on every update. I'm thinking of using redis right now for the lock and autoincrement, but i wondered if mongodb didn't have that feature.
[16:13:03] <benben421> The problem is ensuring that both the update and the autoincrement are performed, or none at all
[16:15:07] <benben421> Another remark is that i don't want to keep the history of my document versions. I just need the version number
[16:17:15] <StephenLynx> what is the update in your case?
[16:17:35] <StephenLynx> you can perform both on the same operation.
[16:17:37] <GothAlice> benben421: Update-if-not-different is the pattern you're looking for, here. db.collection.update({_id: ObjectId(…document to update…), version: 12}, {$inc: {version: 1}, $set: {field: value}})
[16:18:04] <GothAlice> Set the field and bump the version for the record with the given _id, but only if the version is what we expect: 12.
[16:18:26] <StephenLynx> that. the block with stuff to update can have multiple keys. in your case $set and $inc.
[16:19:35] <snowcode> anyone know what's the right format to store GeoJSON data? I get this "Error: MongoError: insertDocument :: caused by :: 16804 location object expected, location array not in correct format" calling newAlarmObj.loc = {type : "Polygon" , coordinates : polygonList}; where polygonList is a simple array in this form: [[10.371094,42.391009]]
[16:19:44] <snowcode> this thing is driving me crazy
[16:23:48] <benben421> @GothAlice : does this update returns true or false if it found something to update ?
[16:24:17] <StephenLynx> afaik, the default is to return information about what was updated.
[16:24:26] <StephenLynx> what platform are you using to develop?
[16:24:29] <GothAlice> benben421: Neither. As always, the documentation is your friend: http://docs.mongodb.org/manual/reference/method/db.collection.update/ (look for WriteResult)
[16:25:50] <benben421> not sure about the driver version
[16:26:06] <StephenLynx> I suggest migrating to io.js.
[16:26:13] <StephenLynx> it is everything node is but better.
[16:26:25] <StephenLynx> second, do you have a reason to use 2.6? it is pretty old.
[16:27:14] <benben421> yeah the project started some time ago. Does it make any difference with regard to my issue ?
[16:27:18] <StephenLynx> and third, if you were not using mongoose (which is awful if you ask me) you could just use the second parameter of the callback to get the operation result.
[16:27:46] <StephenLynx> I don't know. Probably not since I don't think something like this would change since 2.6.
[16:28:11] <StephenLynx> but I still suggest you try and update to 3.0 if the project is not in production.
[16:28:39] <GothAlice> https://jira.mongodb.org/browse/SERVER-17826?filter=17503 < 1,754 improvements and fixes in the 3.x series so far, FYI.
[16:29:07] <StephenLynx> and mongo is not one of those projects that change your basic workflow on major versions.
[16:30:16] <benben421> Ok, thanks very much to all
[16:32:08] <GothAlice> StephenLynx: (https://travis-ci.org/marrow/package — there's a tendency in my code to not be crap, and work without modification on every available runtime, regardless of 2.x or 3.x versioning. Even when the packages do as low-level things as this one. The "waah, Python 3 broke my stuffs" argument is silly these days.)
[16:32:48] <GothAlice> (Polyglot = "speaking many languages" = doesn't have two cares to rub together about which it runs on.)
[16:33:36] <GothAlice> And if you're lazy, there's always: https://warehouse.python.org/project/six/ which does the work for you.
[16:34:17] <StephenLynx> I was not attacking it for once. Still I am pretty sure python DID changed a lot of basic stuff and lots of python 2 code doesn't run on python 3.
[16:35:13] <GothAlice> Can't blame abandoned packages for not being updated to support it. (It really can be as simple as slapping six into a project and altering a few imports to pull from there instead of stdlib.)
[16:36:18] <GothAlice> A classic example is Paste; a suite of web development tools. That thing is a steaming pile, and likely will never be updated for Python 3. Doesn't matter, the good bits have been superseded by discrete packages that _do_ support Python 3, like WebOb. (Request/response classes.)
[16:47:31] <snowcode> anyone used GeoJSON in mongodb/mongoose?
[16:55:56] <snowcode> If anyone can help me: http://stackoverflow.com/questions/29681304/mongoose-mongodb-polygon-data-type-and-validation-error
[17:27:55] <fontanon> Hi everybody! It seems since mongo3.0.x there's no --filter in mongorestore ... so ... how can I skip some documents to be restored now ?
[17:30:06] <fontanon> In fact, I'm looking for some ways to resume a cutted mongorestore operation.
[19:29:37] <grazfather> Hey guys, how do I use $unset on a dict subfield? e.g. a document has a{ b:"", c"" } and I just want to unset b. a { "$unset":{"b":""}) doesn't work and "$unset":{"a":{"b":""}} removes all of a
[19:34:14] <GothAlice> (It's generally advisable to keep your database, collection, and field names within the realm of [a-zA-Z_][a-zA-Z0-9_]* — i.e. what would be a viable variable name in the widest range of languages.
[20:13:03] <GothAlice> ericmj: I find the blog to be the best documentation of how MongoDB works internally: http://www.mongodb.com/blog/post/server-selection-next-generation-mongodb-drivers
[20:13:09] <GothAlice> Also http://www.mongodb.com/blog/post/server-discovery-and-monitoring-next-generation-mongodb-drivers and http://www.mongodb.com/blog/post/consistent-crud-api-next-generation-mongodb-drivers
[20:17:56] <GothAlice> ericmj: And, as you say, MongoDB is open source. If in your investigations you get a clearer picture of how things work, feel free to issue a pull request to improve the docs. :)
[20:20:48] <GothAlice> ericmj: See also: https://github.com/mongodb/specifications/tree/master/source/server-selection https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst and the rest of that "specifications" repository.
[20:21:11] <ericmj> GothAlice: nice, that seems to be exactly what i was looking for
[20:21:24] <GothAlice> Linked to on the blog articles. ;)
[20:21:46] <GothAlice> http://www.mongodb.com/blog/post/announcing-next-generation-drivers-mongodb < the bullet points in the first section of this article linked there. Does seem to be a tiny bit buried.
[22:10:32] <jr3> can I use mongorestore to "replicate" a local mongodb to an aws instance
[22:23:48] <leporello> Good night. Why I can't add array of values to the document with $push?
[22:25:45] <GothAlice> leporello: You can using $each: http://docs.mongodb.org/manual/reference/operator/update/each/#up._S_each
[22:26:54] <leporello> GothAlice, doesn't work too
[22:27:28] <joannac> leporello: pastebin your update
[22:32:19] <leporello> I've added an empty function at the end and it works!
[22:33:18] <leporello> I've spent half of the day on it.
[22:33:39] <GothAlice> leporello: Which DAO/driver are you using?
[22:34:07] <leporello> GothAlice, mongoose, if it's DAO :)
[22:35:42] <GothAlice> Yes, well. Some would consider that to be a Data Inaccess Objects implementation…
[22:38:01] <leporello> it must be findByIdAndUpdate(id, update, someFunc), not just findByIdAndUpdate(id, update), even if I don't want to work with errors or results
[22:38:24] <GothAlice> "Find and update" in general is a bit of an anti-pattern.
[22:38:44] <GothAlice> Notably because in most cases you'll get the document you're updating… prior to the update being applied.
[22:39:54] <leporello> GothAlice, you mean that result inside someFunc?
[22:41:01] <GothAlice> I deal with docs, not functions, since issues like this are cross-driver.
[22:41:51] <leporello> GothAlice, what a lucky man.
[22:42:24] <leporello> Sync RDBMs to async NoSQL blows my mind.
[22:42:35] <jr3> mongoose.connect('mongodb://54.3.23.122:27017/db'); I'm getting invalid URI "url" I dont see any issues
[22:42:48] <GothAlice> (No write concern support, must remember to always specify the "new" option for sanity sake, and that third bullet point contains some doozies relating to multiple matches.
[23:20:39] <sudomarize> I'm trying to set up a replica set, but i get this error when trying to initialize the replica set: https://gist.github.com/sudomarize/952ca4b5955d3258bb34
[23:20:46] <sudomarize> any ideas what i'm doing wrong?
[23:26:47] <DeliriumTremens> using pymongo3 what is the suggested way to insert a subdocument within a subdocument? I can $push to an array in a subdocument, but when i try that with a subdocument it just overwrites
[23:27:02] <DeliriumTremens> using db.coll.update_one
[23:27:47] <GothAlice> What's the exact line, DeliriumTremens?
[23:27:56] <GothAlice> (Gist/pastebin if more than one line.)
[23:43:38] <GothAlice> Note that there are severe disadvantages in that approach. Using a real list is better. To do this, instead of having {reply.id: {…}}, have {id: reply.id, …}
[23:44:04] <GothAlice> The latter approach can benefit from indexes, and is much easier to query in general. (Far fewer machine-generated complex $or trees.)
[23:45:18] <DeliriumTremens> yeah, replies are dicts
[23:46:40] <DeliriumTremens> well, replies are generators
[23:54:10] <DeliriumTremens> fwiw, i'm doing the list currently, but you've answered my question! thanks GothAlice