It all comes down to the fact that you are using arrays to store these documents and those arrays grow without bound and because you are always going to iterate through the full length of your arrays, you might end up having to spend a tremendous amount of gas just to look up some given document inside the proposals array.
In order to solve this issue, stop using arrays altogether inside of your contract and instead use a slightly different data structure.
The data structure that you should use for storing all these proposals, rather than being an array, it will be a mapping.
So, why is a mapping is going to solve your problem?
It all comes down to the search time for each of these data structures. In the Computer Science discipline, whenever we are trying to find some piece of data inside an array, the best case we can get for running that search is Linear Time. When we say that search inside of the array is linear time that means that for every additional record we add to this array, it will take a slightly larger amount of time to execute the search.
If we have 100 elements in the array, it might take 100 seconds. In other words, the size of the array dictates how long the search is going to take.
That is what is going to get you into trouble with gas prices if you go with arrays.
The big difference between an array and mapping is that doing a search inside of a mapping is what is called in Computer Science discipline, Constant Time.
When we say constant time, it means that no matter how many pieces of data we are storing inside this mapping, its always going to take the same amount of time. So if we have one proposal, it will take one second, but if we have a thousand proposals, it still only takes one second to iterate through these proposals.
Clearly, you definitely want to use mapping here.