An order requiring a person to attend and be examined, made pursuant to any provision of this chapter, must require him or her so to attend and be examined either before the judge to whom the order is returnable or before a referee designated therein. Where the examination is taken before a referee, he or she must certify to the judge to whom the order is returnable all of the evidence and other proceedings taken before him or her.