apply BSON encoding hooks to query objects and replace arrays with BasicDBList