You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bson_document.go
    path of file: ./repos/learning/golang/practice/go-crontab/gopath/src/github.com/mongodb/mongo-go-driver/benchmark
    
    the code of the file until where you have to start completion: package benchmark

import (
	"context"
	"errors"

	"github.com/mongodb/mongo-go-driver/bson"
)

func bsonDocumentEncoding(ctx context.Context, tm TimerManager, iters int, source string) error
    
func bsonDocumentDecoding(ctx context.Context, tm TimerManager, iters, numKeys int, source string) error {
	doc, err := loadSourceDocument(getProjectRoot(), perfDataDir, bsonDataDir, source)
	if err != nil {
		return err
	}

	raw, err := doc.MarshalBSON()
	if err != nil {
		return err
	}

	tm.ResetTimer()

	for i := 0; i < iters; i++ {
		out, err := bson.ReadDocument(raw)
		if err != nil {
			return err
		}

		keys, err := out.Keys(true)
		if err != nil {
			return err
		}
		if len(keys) != numKeys {
			return errors.New("document parsing error")
		}
	}
	return nil

}