Background
I'm prototyping a conversion from our RDBMS database to MongoDB. While denormalizing, it seems as if I have two choices, one which leads to many (millions) of smaller documents or one which leads to fewer (hundreds of thousands) large documents.
If I could distill it down to a simple analog, it would be the difference between a collection with fewer Customer documents like this (in Java):
class Customer { private String name; private Address address; // each CreditCard has hundreds of Payment instances private Set<CreditCard> creditCards; }
or a collection with many, many Payment documents like this:
class Payment { private Customer customer; private CreditCard creditCard; private Date payDate; private float payAmount; }
Question
Is MongoDB designed to prefer many, many small documents or fewer large documents? Does the answer mostly depend on what queries I plan on running? (i.e. How many credit cards does customer X have? vs What was the average amount all customers paid last month?)
I've looked around a lot but I didn't stumble into any MongoDB schema best practices that would help me answer my question.