projection

package
v1.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package projection provides projection for aggregations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectDocument

func ProjectDocument(doc, projection *types.Document, inclusion bool) (*types.Document, error)

ProjectDocument applies projection to the copy of the document.

func ProjectionIterator

func ProjectionIterator(iter types.DocumentsIterator, closer *iterator.MultiCloser, projection *types.Document) (types.DocumentsIterator, error)

ProjectionIterator returns an iterator that projects documents returned by the underlying iterator. It will be added to the given closer.

Next method returns the next projected document.

Close method closes the underlying iterator.

func ValidateProjection

func ValidateProjection(projection *types.Document) (*types.Document, bool, error)

ValidateProjection check projection document. Document fields could be either included or excluded but not both. Exception is for the _id field that could be included or excluded.

Command error codes:

  • `ErrEmptyProject` when projection document is empty;
  • `ErrProjectionExIn` when there is exclusion in inclusion projection;
  • `ErrProjectionInEx` when there is inclusion in exclusion projection;
  • `ErrEmptyFieldPath` when projection path is empty;
  • `ErrPathContainsEmptyElement` when projection path contains empty key;
  • `ErrFieldPathInvalidName` when `$` is at the prefix of a key in the path;
  • `ErrWrongPositionalOperatorLocation` when there are multiple `$`;
  • `ErrAggregatePositionalProject` when `$` is used in the suffix key;
  • `ErrAggregatePositionalProject` when positional projection contains empty path;
  • `ErrNotImplemented` when there is unimplemented projection operators and expressions.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL