Emil Genov bio photo

Emil Genov

Software developer living in Barcelona

LinkedIn Github Stackoverflow

If you have a document structure with array in it, for example:

	"arr":[1, 2, 3]

and you want to filter for document with arr array size bigger than x, you can use:

db.collectionName.find({"arr.x" : {"$exists": true}})

you need to substitute x, with the number you want. Logic is that mongo gives you access to array members by index, that is 0 based, so if X position exists, then array is of at least X+1 size.