Priority: Minor - P4
Resolution: Won't Fix
Affects Version/s: 2.2.33, 2.2.34
Fix Version/s: None
This issue affects the documentation of versions 2.3.X
The documentation of the find methods on the class cursos is not accurate and this creates confusion, especially when things that should not work according to documentation works in practice.
Let me explain this with an example. According to documentation find only accepts a single parameter, the query, but looking at the code we can extract the following assertions
- It also accepts a second parameter that can be either an object or an array
- If the second parameter is an object and it has a fields property that property will be used as projection
- If the second parameter is an object, and any of its properties is a know property (fingers crossed), then it will be used as projection. This is specially risky because some known fields are as generic as max and min.
- If the second parameter is an array, a projection object will be created with all the properties as keys of the new object
This situation can create very confusing scenarios. For example, I saw several uses of the mongo driver providing a second argument as projection. Looking at the documentation I thought this code was wrong, but it was working, so I had to debug the mongo driver to see all the scenarios described above.
The questions are:
- will that scenarios be documented some day ?
- Is it a bad Idea to make use of the described features ?
- Will those hidden features be removed on a near future ?
Thanks in advance