func (c *Collection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (int64, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.EstimatedDocumentCount")
	span.Tag("collection", c.coll.Name())
	defer span.End()
	count, err := c.coll.EstimatedDocumentCount(ctx, opts...)
	if err != nil {
		return 0, xo.W(err)
	}
	span.Tag("count", count)
	return count, nil
}
EstimatedDocumentCount wraps the native EstimatedDocumentCount collection method.
package coal
import (
	"context"
	"errors"
	"reflect"
	"github.com/256dpi/lungo"
	"github.com/256dpi/xo"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)
func IsMissing(err error) bool {
	return err == lungo.ErrNoDocuments || errors.Is(err, lungo.ErrNoDocuments)
}
func IsDuplicate(err error) bool {
	return lungo.IsUniquenessError(err)
}
type Collection struct {
	coll lungo.ICollection
}
func (c *Collection) Native() lungo.ICollection {
	return c.coll
}
func (c *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*Iterator, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.Aggregate")
	span.Tag("collection", c.coll.Name())
	csr, err := c.coll.Aggregate(ctx, pipeline, opts...)
	if err != nil {
		span.End()
		return nil, xo.W(err)
	}
	iterator := newIterator(ctx, csr, span)
	return iterator, nil
}
func (c *Collection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.BulkWrite")
	span.Tag("collection", c.coll.Name())
	defer span.End()
	res, err := c.coll.BulkWrite(ctx, models, opts...)
	if err != nil {
		return nil, xo.W(err)
	}
	span.Tag("inserted", res.InsertedCount)
	span.Tag("matched", res.MatchedCount)
	span.Tag("modified", res.ModifiedCount)
	span.Tag("deleted", res.DeletedCount)
	span.Tag("upserted", res.UpsertedCount)
	return res, nil
}
func (c *Collection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.CountDocuments")
	span.Tag("collection", c.coll.Name())
	defer span.End()
	count, err := c.coll.CountDocuments(ctx, filter, opts...)
	if err != nil {
		return 0, xo.W(err)
	}
	span.Tag("count", count)
	return count, nil
}
func (c *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.DeleteMany")
	span.Tag("collection", c.coll.Name())
	defer span.End()
	res, err := c.coll.DeleteMany(ctx, filter, opts...)
	if err != nil {
		return nil, xo.W(err)
	}
	span.Tag("deleted", res.DeletedCount)
	return res, nil
}
func (c *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.DeleteOne")
	span.Tag("collection", c.coll.Name())
	defer span.End()
	res, err := c.coll.DeleteOne(ctx, filter, opts...)
	if err != nil {
		return nil, xo.W(err)
	}
	span.Tag("deleted", res.DeletedCount == 1)
	return res, nil
}
func (c *Collection) Distinct(ctx context.Context, field string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) {
	ctx, span := xo.Trace(ctx, "coal/Collection.Distinct")
	span.Tag("collection", c.coll.Name())
	span.Tag("field", field)
	defer span.End()
	list, err := c.coll.Distinct(ctx, field, filter, opts...)
	if err != nil {
		return nil, xo.W(err)
	}
	span.Tag("length", len(list))
	return list, nil
}