By default, MongoDB prints up to the first 20 documents that match the query.
You can either set DBQuery.shellBatchSize
to increase the limit or use the toArray()
method:
// The current database to use.
use('prices-database');
// Search for documents in the current collection.
db.getCollection('items')
.find({ date: "2022-03-28" })
.toArray()
.map(item => item.price + item.shippingPrice);
This query has been successfully run with the MongoDB for VS Code extension.
References: