![]() ![]() Please make sure you have selected the correct db before executing the query. Also by default, the shell in compass connects to the test db by default. Replace the db.collection.aggregate with db.checklists.aggregate. Regarding Mongo Shell (via Compass) returning empty arrayīased on the screenshots attached in the question, it looks like the collection name is wrong. The unwind is performed to create a unique document for each element in the. You can use the aggregate function like below in order to group based on multiple fields db.collection.aggregate([ You can do this via aggregation framework in Compass, using unwind and group. Can anyone help?Īdding some images or errors I see when running the aggregation suggested in one of the answers below: When you have a query with DISTINCT and ORDER BY, you can only sort by a selected (visible) field: SELECT DISTINCT firstname FROM customers ORDER BY firstname OK firstname which appears in ORDER BY must also appear in SELECT DISTINCT. Question 17 1 1 pts The distinct ridge on the underside of the penis when erect. Manufacturer: ,īut it returns an empty array. Question 17 1 1 pts The distinct ridge on the underside of the penis when erect. ![]() I've tried a query such as: db.checklists.aggregate([ So I would end up with something like Football, Upper Deck, Exquisite, Signature patchįootball, Upper Deck, Exquisite, Foursome Signature patchįootball, Upper Deck, some-other-brand, some-other-variationįootball, Topps, some-other-brand, some-other-variationīaseball, Topps, some-other-brand, some-other-variation I would like to write a query that provides one record for each combination of sport, manufacturer, brand and variation (ignoring that there are multiple cards for each variation). There are a number of cards associated with each variation. Each document has values for the sport, manufacturer, brand and variation (see screengrab below). I have a collection in MongoDB recording information about sport cards.
0 Comments
Leave a Reply. |