[01:02:05] <windsurf_> Is it possible to use $group to come up with a query that will give me a $sum of how many of each value a particular field has?
[01:02:51] <windsurf_> my documents have a 'status' property and the value can be one of 12 values. I want a resulting object with a count for each status value
[01:09:27] <joannac> windsurf_: https://docs.mongodb.com/manual/reference/operator/aggregation/group/#group-by-month-day-and-year <--- that example might be useful
[01:20:06] <windsurf_> joannac I'm having trouble with the syntax. If I just keep the _id line and have a count:{$sum:1} then I get how many parts there are per jobID but what I really want is a count of how many of each status value. This code isn't working but am I getting close? http://pastebin.com/4fhpr76C
[01:22:09] <joannac> if you don't want to group on jobId, then don't group on jobID
[07:00:57] <gokl> Hi, regarding _id as default ObjectId() field, is it garantueed unique across a sharded collection? Or is it only unique in combination with the shard key? Is there something in the docs about it? I couldn't find.
[07:03:23] <joannac> gokl: _id is not guaranteed unique across a sharded collection
[09:22:36] <amitprakash> How do I get a cursor via listIndexes ?
[09:23:02] <amitprakash> I tried db.collection.getIndexes({listIndexes: collection_name}).cursor, but that doesn't seem to work
[09:23:10] <amitprakash> since the output for getIndexes is an array
[09:31:06] <Derick> amitprakash: also, what you done is the the way to run the listIndexes command
[09:31:26] <amitprakash> Derick, so I can't filter indexes at all?
[09:31:58] <Derick> you'd do that with: db.runCommand( { listIndexes: 'colname' } );
[09:32:37] <Derick> the .cursor you get back from that is not equivalent from a normal cursor though - because it's already executed on the server, you can't do any (server side) filtering on it. It is something you're going to have to do in your client/application.
[09:49:32] <gokl> Is it possible to get the hash value of a hashed index? I have a hashed index on _id (ObjectId) and would like to see the hash for a given document.
[10:22:19] <r0j4z0> one quick question im struggling with
[10:23:10] <r0j4z0> im running mongo --quiet --host ds2_silver/172.20.234.70:29017,172.20.234.79:29017,172.20.234.80:29017 keyon --eval="db.Consumers.find()"
[10:23:26] <r0j4z0> but im still getting NETWORK messages
[10:23:43] <r0j4z0> 2016-09-16T12:10:58.791+0200 I NETWORK starting new replica set monitor for replica set ds2_silver with seeds 172.20.234.70:29017,172.20.234.79:29017,172.20.234.80:29017
[10:23:43] <r0j4z0> 2016-09-16T12:10:58.792+0200 I NETWORK [ReplicaSetMonitorWatcher] starting
[10:23:55] <r0j4z0> is there any way to disable those messages too?
[12:20:04] <LowWalker> So I'm doing some automation to bring up a 2 slave 1 master cluster, I'm still not getting good responses when trying rs.conf() or rs.status()
[12:20:23] <LowWalker> Here's what I am seeing for those might who be bored enough to help :) - https://gist.github.com/lowwalker/ee8bd52a5b75aeb0373f0372ab73de46
[12:22:07] <joannac> what's the response when you run the rs.initiate(.....) command?
[12:24:08] <cheeser> replicaSetPrimar: please fix your connection. you've been bouncing in and out for over a day now.
[12:43:00] <cheeser> tried to leave a message but apparently that's just chanserv akicks :)
[12:43:39] <joannac> LowWalker: you can only initiate a replica set if at most one node has data
[12:44:06] <joannac> and in that case, the node with data is the one you want to run rs.initiate() on
[12:44:20] <LowWalker> So these are vagrants, I'm blowing them away each time. I'm installing mongo-org* packages then running that script on the master node
[12:44:29] <LowWalker> To my knowledge there should be no data...
[14:03:40] <mw44118> Hey, I have a collection of users and a collection of purchases by user. I want to get all purchases for a given user's email address. I want to do something like db.purchases.find({user_id: db.users.find({email_address: "mork@example.com"}}) But that doesn't work. Is it possible to do a find inside another find?
[14:08:56] <mw44118> How do I do "x matches the c attributes of a.b.c"?
[16:37:24] <windsurf_> I'm having trouble getting the syntax right for this query. Just want to get multiple sums per document based on occurance of various values http://pastebin.com/Wd4siz2v
[16:40:15] <windsurf_> can anyone point out what I'm missing?
[16:42:46] <windsurf_> I'm just trying to count the number of occurrences of each value for a field
[16:43:37] <mw44118> windsurf_: so, like select id, count(*) from ... group by id;
[16:44:53] <windsurf_> mw44118 maybe... is that a SQL query or mongo?
[17:30:33] <mw44118> windsurf_: that was me making sure I understood your goal.
[17:32:13] <AndrewYoung> windsurf_: You can think of each thing you put in the _id field of the $group stage as an additional "group by" field in an equivalent SQL query.
[17:33:17] <AndrewYoung> The result you get would be the same.
[17:33:30] <AndrewYoung> Want you want is a second $group stage.
[17:33:38] <AndrewYoung> You want to group the results of the initial grouping.
[17:34:56] <AndrewYoung> Although having said that, it might be easier to do it in code.
[17:48:15] <windsurf_> AndrewYoung Thanks, how about not grouping by jobID but instead just including the jobID field?
[17:48:56] <windsurf_> I've been trying it and so far all I've come up with is jobID:{$first:'$jobID'} but I'm worried that might exclude some jobID values
[17:55:43] <windsurf_> hm. just tried adding a $match before $group. I'll need multiple queries but it will work, not as elegant though
[18:07:04] <AndrewYoung> Sorry, my IRC client took a dive
[20:27:51] <StephenLynx> the documented one is deleteMany
[20:50:41] <crazyphil> ok, how the heck do I create a user that can query on local.oplog.rs AND query on config.shards?
[20:51:04] <crazyphil> I've assigned multiple roles to a user, but it seems as if only the first one is seen
[20:54:58] <AlmightyOatmeal> is it possible to execute a lucene query within mongo or know of a pythonic method of parsing the lucene query to translate it into something mongodb friendly?
[20:58:25] <crazyphil> lucene is a text indexing system, most commonly found in Elasticsearch
[20:59:32] <AlmightyOatmeal> StephenLynx: yup, part of our elasticsearch backend; queries look like: (metric:if_octets.rx AND _missing_:programId) AND (tacocat:tacokitty)
[21:00:22] <crazyphil> AlmightyOatmeal: so you have the same data in ES and mongo? I'm not understanding the use case here
[21:02:07] <AlmightyOatmeal> crazyphil: correct but i'm using mongodb as a cache to perform data analytics on. i scroll through parts of ES, seamlessly dump it in mongodb, and go crazy on mongodb so i dont impact the production ES cluster.
[21:02:27] <AlmightyOatmeal> crazyphil: there is so much data in ES that performing analytics directly in ES could take weeks :\
[21:03:30] <crazyphil> sounds like you need a bigger ES cluster then
[21:03:40] <crazyphil> or you need to do some map-reducing
[21:04:51] <AlmightyOatmeal> crazyphil: oh don't get me started on the ES setup... unfortunately that's not my department although i have said "i told you so" to some of the ES architect team more than once
[21:06:30] <AlmightyOatmeal> crazyphil: some of the results contain a script that gets executed by another set of applications and part of that execution is an ES query -- that query is what i'm trying to parse out and turn into a mongodb query
[21:06:52] <AlmightyOatmeal> and so far pyparsing has been an absolute Rube Goldberg wet dream
[21:13:27] <crazyphil> ok, so you query ES with some query {}, and in its results a script is returned that other apps use?
[21:20:36] <crazyphil> for pete's sake it should not be this difficult to give a user rights across multiple db's
[21:29:22] <Doyle> Would there be any issue in doing an rs init, replicating in a new member (to get a new hardware profile), then doing rs remove, stopping mongo, and starting it without the RS config entry to get it in standalone mode? 3.0 mmapv1
[21:56:12] <crazyphil> ok, this is moronic, I assign a user multiple roles, however when I try to actually use BOTH roles assigned to the user, only the first one in the array works
[22:50:26] <Guest24> So I got a query that seems to take longer every time I go through it
[23:42:50] <Guest24> I wonder how I can debug this :/ I can't make the query any simpler
[23:43:31] <Guest24> I thought maybe it's processing from bytes to structs, but that wouldn't explain why it worked for the first 100k records and is slowing down slowly
[23:43:42] <Guest24> to the point where it now times out
[23:44:50] <Guest24> Please someone tell me if I'm being blind and doing something really silly here: https://gist.githubusercontent.com/jamieshepherd/8910666c6c56f8eab7f12197ab00dcdb/raw/e677df7caaf14bf9b829dd76cd8e6e26a4624790/query.go
[23:49:32] <Guest24> the strange thing is that it's slowed as I've gotten through them, and as I go through them I set eloComplete to false or true (thus not pulling them in again on a subsequent query)