Interface SearchPath

All Superinterfaces:
org.bson.conversions.Bson
All Known Subinterfaces:
FieldSearchPath, WildcardSearchPath

@Sealed @Beta(CLIENT) public interface SearchPath extends org.bson.conversions.Bson
A specification of fields to be searched.

Depending on the context, one of the following methods may be used to get a representation of a SearchPath with the correct syntax: Bson.toBsonDocument(), toBsonValue(), FieldSearchPath.toValue().

Since:
4.7
MongoDB Atlas documentation
Path
  • Field Summary

    Fields inherited from interface org.bson.conversions.Bson

    DEFAULT_CODEC_REGISTRY
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a SearchPath for the given path.
    default org.bson.BsonValue
    Converts this object to BsonValue.
    wildcardPath(String wildcardPath)
    Returns a SearchPath for the given wildcardPath.

    Methods inherited from interface org.bson.conversions.Bson

    toBsonDocument, toBsonDocument
  • Method Details

    • fieldPath

      static FieldSearchPath fieldPath(String path)
      Returns a SearchPath for the given path.
      Parameters:
      path - The name of the field. Must not contain wildcard characters.
      Returns:
      The requested SearchPath.
      MongoDB documentation
      Dot notation
    • wildcardPath

      static WildcardSearchPath wildcardPath(String wildcardPath)
      Returns a SearchPath for the given wildcardPath.
      Parameters:
      wildcardPath - The specification of the fields that contains wildcard ('*') characters. Must not contain '**'.
      Returns:
      The requested SearchPath.
      MongoDB documentation
      Dot notation
    • toBsonValue

      default org.bson.BsonValue toBsonValue()
      Converts this object to BsonValue. If Bson.toBsonDocument() contains only the "value" key, then returns BsonString representing the value of this key, otherwise returns Bson.toBsonDocument().

      This method may be useful when using the of methods, e.g., SearchHighlight.of(Bson). Depending on the syntax of the document being constructed, it may be required to use the method FieldSearchPath.toValue() instead.

      Returns:
      A BsonValue representing this SearchPath.
      See Also: