10

When I open a collection, it only displays the first 50 documents rather then all of them. How do I make it so that RoboMongo display all documents in the collection (preferably automatically)?

robomongo result

BenSmith
  • 319
  • 4
  • 13
  • *Unrelated to your problem* MongoDb company has created a free to use tool to look and manipulate database data. [mongodb-compass](https://www.mongodb.com/products/compass). – Orelsanpls Nov 23 '17 at 14:46
  • @GrégoryNEUT that tool doesn't allow you to change the batch size of returned documents, so is not a viable alternative to solve this problem – camslice Dec 12 '19 at 02:41
  • @camslice mongodb-compass offers you a full pagination of what's in the collections. So the problem does not apply at all. – Orelsanpls Dec 12 '19 at 09:06
  • @GrégoryNEUT RoboMongo (or Robo 3T) also offers full pagination, with its default batch size being 50. You can change this size to whatever you like via the config file (see answers below). However mongodb-compass has a default batch size of 20 which you can't change via a config file or through any app settings. The question does not ask for "full pagination" it asks to see "all of [the documents]". – camslice Dec 16 '19 at 01:30

3 Answers3

13

UPDATE 06 december 2019: The initial solution is not working from the v1.3.1 of Robomongo. If you enter 0, Robomongo will throw an error. See the EDIT 1 for new solution.

There is an input at the upper right which gives you the possiblity to change the number of displayed documents, just under the query. Change it to 0 and press Enter. It'll load all documents.

The input buttons

Even if the 50 reappears after, you have all documents displayed.

EDIT 1: The above seems to be fixed in the newer releases (from v1.3.1).

As suggested by @learnsomemore in the comments, you can add DBQuery.shellBatchSize = 500; before your query to change the returned array size.

This was originaly given in a comment by @davidm06 in the GitHub issue "Aggregate only shows 50 results #1157" from the RoboMongo public repository.

Paul Rey
  • 1,006
  • 12
  • 24
  • 1
    maybe they thought this was a bug and fixed it, it throws an error that it must be greater than 0 in v1.3.1. If i make it more than 50, it still doesn't give me more than 50. – learnsomemore Dec 05 '19 at 17:07
  • I did not test recently, maybe this is fixed! :) – Paul Rey Dec 05 '19 at 17:08
  • 2
    I just saw this on their github issues thread. Please update your answer to include this which i tested works. https://github.com/Studio3T/robomongo/issues/1157#issuecomment-345234270 Just add this above the query `DBQuery.shellBatchSize = 500;` – learnsomemore Dec 05 '19 at 17:10
  • Thanks for the update, I did it :) – Paul Rey Mar 18 '21 at 16:07
11

You can change the default batch size:

  • Edit robomongo.json (in ~/.config/robomongo/<version>/ on Linux/MacOS, in c:\Users\YourName\.config\<version>/ on Windows)
  • Change the batchSize attribute, you can choose a value of fixed size (e.g. 100) or choose 0 to mean "all documents" (h/t to @PaulRey though I've had mixed results in using this symbolic, see comments below this question):

    {
      "batchSize" : 100,
      ...
    }
    
  • Save robomongo.json and restart RoboMongo

This allows you to increase the default batch size albeit at the potential cost of waiting longer for results.

More details in the docs.

glytching
  • 35,192
  • 8
  • 84
  • 96
  • You can set the value 0 which is apparently interprated as "all" documents. It works in the UI. – Paul Rey Nov 23 '17 at 15:55
  • 1
    @PaulRey Thanks, though in an earlier verison of my answer I actually suggested `0` as the symbolic which means: "all documents" and then I tested by setting `batchSize: 0` in robomongo.json (on Robomongo 0.9.0-RC3) and got mixed results so I edited my answer to remove that suggestion. – glytching Nov 23 '17 at 15:58
  • 4
    Can confirm this still works on version 1.3.1, however the location and name of the JSON file have changed over time: https://github.com/Studio3T/robomongo/wiki/Robomongo-Config-File-Guide For v1.3.1 it's: `.3T/robo-3t/1.3.1/robo3t.json` – camslice Dec 12 '19 at 02:38
  • This did not work for me, when I set the value in the json and restarted the program, it was set back to 50... – craastad May 04 '21 at 14:47
7

You can also use toArray() at the end to get the whole result at once.

example toArray()

Melchia
  • 16,699
  • 16
  • 70
  • 93