[03:12:32] <the_f0ster> I am running an aggregate function and can't figure out how to get the data out of the response object.. any suggestions ? https://gist.github.com/f0ster/821fc822521695b80843758ab42b15fb
[14:50:03] <Zelest> in my situation that's more than enough :)
[14:50:09] <GothAlice> Zelest: Also, minor note since it doesn't seem to have been mentioned yet, if your "_id" field is an ObjectId (and it should in most cases), it includes the creation time built-in. No need for an additional field in the majority of cases. https://docs.mongodb.com/manual/reference/method/ObjectId/
[14:54:30] <Zelest> paranoia is a gift, not a curse
[14:56:06] <GothAlice> It's not millisecond accurate, but that's "eh?" for most use cases, and there exist no warnings against use (and methods to explicitly support use) in the general shell documentation and Python driver documentation, as examples. I.e. https://docs.mongodb.com/manual/reference/method/ObjectId/ (+ getTimestamp() method) and http://api.mongodb.com/python/current/api/bson/objectid.html (with from_datetime factory and generation_time accessor).
[14:56:40] <Derick> GothAlice: you can't do a simple range search on it though
[14:56:45] <Derick> (ie, between this and this date
[15:02:17] <StephenLynx> oh, you haven't seen nothing yet
[15:02:26] <StephenLynx> wait until you ask framework related questions :^)
[15:02:39] <GothAlice> Derick: In the face of officially supported, documented, and a with multiple example features, calling it "abuse" → http://s.webcore.io/e7Sk/opinion-man.jpg
[15:04:30] <GothAlice> Now, on the other hand, since I can't len() a BulkOps set to see how many operations have been added, I'm forced to access ops._BulkOperationBuilder__bulk.ops — now *that* is a hack.
[15:05:17] <GothAlice> (Notably, because I explicitly do not want an exception raised in the "no-op" case, as it currently does if you try to .execute() an empty BulkOps set.)
[15:05:29] <Derick> GothAlice: PHP gets that one right: http://php.net/manual/en/mongodb-driver-bulkwrite.count.php ;-)
[15:06:07] <GothAlice> Derick: So does the Python one, if I went one abstraction layer deeper in the first place. Not quite the same things being compared, here.
[15:06:26] <GothAlice> (I.e. I'm using the BulkOperationBuilder wrapper around the BulkWrite object.)
[15:06:50] <GothAlice> In the direct use of BulkWrite case, I'd have direct access to the ops anyway (note the last .ops dereference in my hack example.)
[15:07:34] <GothAlice> No such comparable functionality exists in the PHP driver. ;)
[15:08:01] <StephenLynx> not being PHP is already a functionality on itself.
[15:08:49] <Derick> GothAlice: no, because it belongs in the PHP library. Deliberate choice to keep the driver as lean as possible. Things like creating ObjectIDs from timestamps should *also* go there.
[15:14:02] <cr0mulent> Hello, I have a question about $lookup. What does the “as” Field do? I don’t understand it. https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/
[15:14:47] <GothAlice> cr0mulent: It's the name of the field you want the result of the operation saved into.
[15:15:32] <cr0mulent> GothAlice: Can I write the results to the console?
[15:15:43] <cr0mulent> I don’t want to save the results to anything, I’m trying to do a query.
[15:16:12] <cr0mulent> Can I use $lookup with .find()
[15:16:19] <GothAlice> No. It's an aggregate pipeline operation.
[15:16:52] <GothAlice> Unless your aggregate has an $out stage, the results are sent to your client (i.e. the mongo shell, or your application) in a way similar to a .find()
[15:19:28] <cr0mulent> GothAlice: So my Aggregate query contains $lookup but it does not contain $out. This will output the results to the client, correct?
[15:19:58] <GothAlice> cr0mulent: Try it out. :) (Yes.)
[15:20:14] <GothAlice> cr0mulent: https://docs.mongodb.com/manual/core/aggregation-pipeline/ is the general documentation for aggregation. It's used to process data through a "pipeline" of operations before returning the data to your application or mongo shell. Find gets data, but the operations you can perform on the data server-side are limited vs. aggregation.
[15:22:13] <phutchins> I'm trying to migrate from one sharded cluster to another and when I start to try to add one of the new mongod's I get "Unauthorized: not authorized on admin to execute command" for the heartbeat request. Anyone know how to get around that?
[15:23:04] <phutchins> I just simply create a user on the admin db?
[17:40:53] <cheeser> you can index them like any other field but i don't think that factors in to $addToSet. that will do a full scan of the array to ensure uniqueness of the new vlaue
[18:44:42] <paperziggurat> having trouble with a lock on a file that won't let me run mongod without su. does anyone know where the mongo conf file is typically located on OSX when installed via homebrew?