correctly expand and collapse doc in filter() so that dot notation keys are not stripped out