Clicky

Mongo - Select max field (aggregate, $project, $macth)

February 26, 2016

(based on http://schema.org/Product schema)
<![CDATA[ db.user.aggregate([ { $match: {productID:“1”} }, { $project: {_id: “$productID”, highPrice: { $max: “$offers.highPrice”}} } ]) ]]>
SyntaxHighlighter.highlight();