How to select documents larger than x bytes?


Is there a way to list documents that are large/smaller than x bytes?


Hey @moon0326,

I know this isn’t exactly bytes like you were initially looking for, but would something like this work?:

You can create a view that does JSON.stringify on every document, get the length, and then do some logic to emit results based on the string length. Of course each character in a string could have a different byte size depending on the character encoding, but maybe this will accomplish enough of what you need?

Let me know if this helps at all.


1 Like

@nraboy Thank you! Yes, I think that trick should work :slight_smile:


Reach out if you need anything else :slight_smile: