Mongosh displayBatchSize config not working

When I run

config.set("displayBatchSize", 2)

or

config.set("displayBatchSize", 2000)

My distinct query

db.MyTable.distinct("person.id")

returns 100 items.

I have 245 items that I’m trying to return. It doesn’t look like the displayBatchSize is working properly.

Thanks,

Tam

Hi @Tam_Nguyen1,

I believe the behaviour you’re experiencing is expected. As per the configure shell documentation, specific to the displayBatchSize property description:

The number of items displayed per cursor iteration

The distinct() command does not return a cursor (comparing to a find() which does return a cursor):

myFirstDatabase >db.manydocs.distinct.returnType
{ type: 'unknown', attributes: {} }
myFirstDatabase> db.manydocs.find.returnType
Cursor

Just for more context, can you describe what the use case is here for wanting to return all 245 items using distinct() in the shell? You could get all the results on the application side if this works for you (more details on this on the distinct command documentation)

Regards,
Jason

Hi @Jason_Tran,

Thanks for the reply that makes sense to me. I just grabbed all of it and used excel to get the distinct values instead. I was trying to find what documents were being used so I could delete the unused documents.

Regards,

Tam

1 Like

Makes sense - Thanks for confirming the method you used to retrieve all the values :slight_smile:

You could raise a feedback post to have a setting in the shell in future to possibly allow this to be expanded.

Regards,
Jason

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.