Working on Self-Hosted Server (version 1.5.10) with Flutter project.
Hi, I have a collection with Array of Strings attribute.
I would like to create a query of all the documents where the number of values in the array are, let's say, more than 1 value.
It goes further, since I would like to have a query for documents that has more than 3 and less than 7.
Is there a way to do in ?
TL;DR
Developers working on a Flutter project on a Self-Hosted Server (version 1.5.10) want to query documents based on the number of values in an array attribute -
- To query documents with more than 1 value in the array:
db.collection.find({ 'arrayField': { $exists: true, $not: { $size: 1 } } });
- To query documents with more than 3 and less than 7 values in the array:
db.collection.find({ 'arrayField': { $exists: true, $not: { $size: 1 } }, $expr