Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 854 Bytes

find-batch-size.md

File metadata and controls

22 lines (16 loc) · 854 Bytes

How to return more than 20 items from MongoDB

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: