[01:21:14] <Omega037> so i have almost no experience in MongoDB, but a platform we use at work uses MongoDB under the hood and has a query box for getting info that isnt normally displayed in the control panel
[01:22:15] <Omega037> what i basically want to do is to get a list of organizationId from db.organizations and use that list against db.users which has the names for the organizations
[01:22:56] <Omega037> first, how do i get a find() to become a variable holding a list of these ids
[01:23:31] <Omega037> right now im doing var = db.organizations.find({ }, {"organizationId"});
[01:24:31] <Omega037> then i basically want to iterate through that list against db.users.find({"_id": var},{"name":1})
[08:51:44] <humblewolf> can I use grouping in cursor ??
[08:54:27] <Derick> Sorry, I don't understand that question. What would you like to do?
[09:03:11] <humblewolf> Derick: I find() some data from a collection, now I want to group this data based on some field , is there any built-in method on cursor object that does this ?? I'm new to mongo
[09:03:42] <humblewolf> i know we can use aggregate() on client object
[09:08:27] <Derick> You can't do that on a cursor object, because by that time, the query has already executed. The Aggregation Framework is the way to go
[09:20:43] <humblewolf> Derick: Can I specify constraints in it ?
[09:23:28] <Derick> you can do a $match stage first
[09:25:46] <humblewolf> Derick: got it, i have a query, will this pipeline logic iterate over every document in collection and test it against stages ?
[10:53:13] <humblewolf> Derick: one more query, my pipeline is [match->group(here I push entire document that falls in a group using $$ROOT)] , now i want to sort the subgroup of documents by TIMESTAMP and the pick the latest document, any suggestions ??
[10:55:12] <Derick> do the sort before the group, and then instead of $$ROOT, use something like $last
[10:55:49] <Derick> (you'd have your match first before the $sort in that example)
[10:58:30] <pandaadb> Hi - I sadly forgot to ask that last week. Can yo connect a stitch app to a single node or a read only replica on atlas?
[10:59:08] <Derick> I didn't think you could deploy single nodes on Atlas?
[10:59:54] <pandaadb> oh i worded that terribly then :) I have atlas, with a 3 node cluster + 1 read replica (I hope that's right) and I was wondering if i can tell stitch that it may not talk to the production cluster that I use for writes but rather only talk to the read only node there is
[11:00:48] <pandaadb> i think read-replica is wrong too, it says "Read-only"
[11:01:23] <Derick> I don't think you can do that.
[11:02:08] <pandaadb> ah that's too bad, thanks Derick
[11:02:30] <pandaadb> i am slightly worried that if i start giving people connections via stitch everywhere i loose control over what is happening
[11:03:32] <Derick> I think you can set-up auth rules/roles and require them to be read-only, but I've not played with that so I'm not sure
[11:04:43] <pandaadb> Yep that's possible. I was more wondering of people trying to scrape the database off all its data since they now have direct access to it.
[11:08:42] <Derick> they shouldn't have direct access to it?
[11:12:33] <humblewolf> Derick: done , thanks for your support !!!!
[11:36:27] <pandaadb> Ah sorry - Derick i meant direct access in terms of the full query language on mongodb, being able to run any silly query they'd like to run
[11:49:18] <Derick> pandaadb: you can make views for them though
[11:56:46] <pandaadb> how have i not heard of this before :)
[13:23:31] <akkonrad> I have 2 collection, post and comments. I want to make a query to get all posts with their comments, but if post has no comment it's not included in the results. here is the query: https://www.pastery.net/qdwzqs/
[13:23:53] <akkonrad> what I would exepect from this query is to return all posts and if there is a comment then it would have comment property
[14:05:59] <rc96> I'm using MongoDB 4.0.0 Community
[14:21:17] <Derick> rc96: shouldn't be a trick needed
[15:20:11] <akkonrad> is there a way that I can use $match and $or in the same condition? I would like to find all items where body of the post contains a keyword, or any of it's comments. here is my $match section, but it returns only results where keyword is both in body and in comments: https://www.pastery.net/gjdeqe/
[15:24:43] <Derick> you need a }, { in between line 4 and 5
[15:25:03] <Derick> now you're doing an $or with *one* element, where that one element is an $and
[17:20:12] <rebab> I can't use diacriticSensitive option can someone help me?