If you know the document ID, it might be more efficient to use the K/V service. A K/V subdocument lookup “count” operation returns the number of elements if the path refers to an Array, or the number of fields if the path refers to an Object.
Here’s what that might look like in Java:
LookupInResult result = collection.lookupIn(
documentId,
singletonList(LookupInSpec.count("addresses"))
);
int addressCount = result.contentAs(0, Integer.class);