My database is a collection of items on ebay. I want to list the number of related items that come up with the item "Stop watch". I only want the number of related items as the answer. So far i have the code as shown below which gives me an error. Could someone please help me.
db.getCollection('products').aggregate([ {$match: {product: {"Stop Watch"}}}, { $group:{ _id: {related: "$related", product: "$title"}}},{$count:"relatedAndProduct"} ])
This code gives me an error.
My database is a collection of items on ebay. I want to list the number of related items that come up with the item "Stop watch". I only want the number of related items as the answer. So far i have the code as shown below which gives me an error. Could someone please help me.
db.getCollection('products').aggregate([ {$match: {product: {"Stop Watch"}}}, { $group:{ _id: {related: "$related", product: "$title"}}},{$count:"relatedAndProduct"} ])
This code gives me an error.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1dc789de-ed3c-44e4-bd99-8d7edbd72e42%40googlegroups.com.