MongoDB gives us the ability to express which fields we are interested in when running a query. Which is exactly what the @fields array is for.
This changes modifies the cursor to only select interesting fields. This gives a very nice performance boost on the perl side (3s => 1s to fetch 50k sessions in LemonLDAP's session browser), makes bandwidth to the mongo server much lower, and it also allow MongoDB to use a covered query if its indexes allow it.
MongoDB gives us the ability to express which fields we are interested in when running a query. Which is exactly what the
@fields
array is for.This changes modifies the cursor to only select interesting fields. This gives a very nice performance boost on the perl side (3s => 1s to fetch 50k sessions in LemonLDAP's session browser), makes bandwidth to the mongo server much lower, and it also allow MongoDB to use a covered query if its indexes allow it.