Functions

The following functions are available globally.

  • A helper function to test equality between two BSONValues. This function tests for exact BSON equality. This means that differing types with equivalent value are not equivalent.

    e.g. 4.0 (Double) != 4 (Int)

    NOTE: This function will always return false if it is used with two arrays that are not of the type [BSONValue], because only arrays composed of solely BSONValues are valid BSON arrays.

      • lhs: The left-hand-side BSONValue to compare.
      • rhs: The right-hand-side BSONValue to compare.

    Declaration

    Swift

    @available(*, deprecated, message: "Use lhs.bsonEquals(rhs﹚ instead")
    public func bsonEquals(_ lhs: BSONValue, _ rhs: BSONValue) -> Bool

    Return Value

    true if lhs is equal to rhs, false otherwise.

  • A helper function to test equality between two BSONValue?s. See bsonEquals for BSONValues (non-optional) for more information.

      • lhs: The left-hand-side BSONValue? to compare.
      • rhs: The right-hand-side BSONValue? to compare.

    Declaration

    Swift

    @available(*, deprecated, message: "use lhs?.bsonEquals(rhs﹚ instead")
    public func bsonEquals(_ lhs: BSONValue?, _ rhs: BSONValue?) -> Bool

    Return Value

    True if lhs is equal to rhs, false otherwise.