class documentation

A ViewExpression that refers to an ObjectId of a document.

The typical use case for this class is writing an expression that involves checking if the ID of a document matches a particular known ID.

Example:

from fiftyone import ViewField as F
from fiftyone.core.expressions import ObjectId

# Check if the ID of the document matches the given ID
expr = F("_id") == ObjectId("5f452489ef00e6374aad384a")
Parameters
oidthe object ID string
Method __init__ Undocumented
Method to_mongo Returns a MongoDB representation of the ObjectId.

Inherited from ViewExpression:

Static Method all Checks whether all of the given expressions evaluate to True.
Static Method any Checks whether any of the given expressions evaluate to True.
Static Method enumerate Returns an array of [index, element] pairs enumerating the elements of the given expression, which must resolve to an array.
Static Method literal Returns an expression representing the given value without parsing.
Static Method rand Returns an expression that generates a uniform random float in [0, 1] each time it is called.
Static Method randn Returns an expression that generates a sample from the standard Gaussian distribution each time it is called.
Static Method range Returns an array expression containing the sequence of integers from the specified start (inclusive) to stop (exclusive).
Static Method zip Zips the given expressions, which must resolve to arrays, into an array whose ith element is an array containing the ith element from each input array.
Method __abs__ Computes the absolute value of this expression, which must resolve to a numeric value.
Method __add__ Adds the given value to this expression, which must resolve to a numeric value, self + other.
Method __and__ Computes the logical AND of this expression and the given value or expression, self & other.
Method __call__ Retrieves the specified field or embedded field of this expression, which must resolve to a document.
Method __ceil__ Computes the ceiling of this expression, which must resolve to a numeric value.
Method __deepcopy__ Undocumented
Method __eq__ Determines whether this expression is equal to the given value or expression, self == other.
Method __floor__ Computes the floor of this expression, which must resolve to a numeric value.
Method __ge__ Determines whether this expression is greater than or equal to the given value or expression, self >= other.
Method __getitem__ Returns the element or slice of this expression, which must resolve to an array.
Method __gt__ Determines whether this expression is greater than the given value or expression, self >= other.
Method __hash__ Undocumented
Method __invert__ Inverts this expression, ~self.
Method __le__ Determines whether this expression is less than or equal to the given value or expression, self <= other.
Method __len__ Undocumented
Method __lt__ Determines whether this expression is less than the given value or expression, self <= other.
Method __mod__ Computes the modulus of this expression, which must resolve to a numeric value, self % other.
Method __mul__ Computes the product of the given value and this expression, which must resolve to a numeric value, self * other.
Method __ne__ Determines whether this expression is not equal to the given value or expression, self != other.
Method __or__ Computes the logical OR of this expression and the given value or expression, self | other.
Method __pow__ Raises this expression, which must resolve to a numeric value, to the given power, self ** power.
Method __radd__ Undocumented
Method __rand__ Undocumented
Method __repr__ Undocumented
Method __rmod__ Undocumented
Method __rmul__ Undocumented
Method __ror__ Undocumented
Method __round__ Rounds this expression, which must resolve to a numeric value, at the given decimal place.
Method __rsub__ Undocumented
Method __rtruediv__ Undocumented
Method __str__ Undocumented
Method __sub__ Subtracts the given value from this expression, which must resolve to a numeric value, self - other.
Method __truediv__ Divides this expression, which must resolve to a numeric value, by the given value, self / other.
Method abs Computes the absolute value of this expression, which must resolve to a numeric value.
Method append Appends the given value to this expression, which must resolve to an array.
Method apply Applies the given expression to this expression.
Method arccos Computes the inverse cosine of this expression, which must resolve to a numeric value, in radians.
Method arccosh Computes the inverse hyperbolic cosine of this expression, which must resolve to a numeric value, in radians.
Method arcsin Computes the inverse sine of this expression, which must resolve to a numeric value, in radians.
Method arcsinh Computes the inverse hyperbolic sine of this expression, which must resolve to a numeric value, in radians.
Method arctan Computes the inverse tangent of this expression, which must resolve to a numeric value, in radians.
Method arctanh Computes the inverse hyperbolic tangent of this expression, which must resolve to a numeric value, in radians.
Method cases Applies a case statement to this expression, which effectively computes the following pseudocode:
Method ceil Computes the ceiling of this expression, which must resolve to a numeric value.
Method concat Concatenates the given string(s) to this expression, which must resolve to a string.
Method contains Checks whether this expression, which must resolve to an array, contains any of the given values.
Method contains_str Determines whether this expression, which must resolve to a string, contains the given string or string(s).
Method cos Computes the cosine of this expression, which must resolve to a numeric value, in radians.
Method cosh Computes the hyperbolic cosine of this expression, which must resolve to a numeric value, in radians.
Method day_of_month Returns the day of the month of this date expression (in UTC) as a number between 1 and 31.
Method day_of_week Returns the day of the week of this date expression (in UTC) as a number between 1 (Sunday) and 7 (Saturday).
Method day_of_year Returns the day of the year of this date expression (in UTC) as a number between 1 and 366.
Method difference Computes the set difference of this expression, which must resolve to an array, and the given array or array expression.
Method ends_with Determines whether this expression, which must resolve to a string, ends with the given string or string(s).
Method exists Determines whether this expression, which must resolve to a field, exists and is not None.
Method exp Raises Euler's number to this expression, which must resolve to a numeric value.
Method extend Concatenates the given array(s) or array expression(s) to this expression, which must resolve to an array.
Method filter Applies the given filter to the elements of this expression, which must resolve to an array.
Method floor Computes the floor of this expression, which must resolve to a numeric value.
Method hour Returns the hour portion of this date expression (in UTC) as a number between 0 and 23.
Method if_else Returns either true_expr or false_expr depending on the value of this expression, which must resolve to a boolean.
Method insert Inserts the value before the given index in this expression, which must resolve to an array.
Method intersection Computes the set intersection of this expression, which must resolve to an array, and the given array(s) or array expression(s).
Method is_array Determines whether this expression is an array.
Method is_in Creates an expression that returns a boolean indicating whether self in values.
Method is_missing Determines whether this expression refers to a missing field.
Method is_null Determines whether this expression is null.
Method is_number Determines whether this expression is a number.
Method is_string Determines whether this expression is a string.
Method is_subset Checks whether this expression's contents, which must resolve to an array, are a subset of the given array or array expression's contents.
Method join Joins the elements of this expression, which must resolve to a string array, by the given delimiter.
Method length Computes the length of this expression, which must resolve to an array.
Method let_in Returns an equivalent expression where this expression is defined as a variable that is used wherever necessary in the given expression.
Method ln Computes the natural logarithm of this expression, which must resolve to a numeric value.
Method log Computes the logarithm base base of this expression, which must resolve to a numeric value.
Method log10 Computes the logarithm base 10 of this expression, which must resolve to a numeric value.
Method lower Converts this expression, which must resolve to a string, to lowercase.
Method lstrip Removes whitespace characters from the beginning of this expression, which must resolve to a string.
Method map Applies the given expression to the elements of this expression, which must resolve to an array.
Method map_values Replaces this expression with the corresponding value in the provided mapping dict, if it is present as a key.
Method matches_str Determines whether this expression, which must resolve to a string, exactly matches the given string or string(s).
Method max Returns the maximum value of either this expression, which must resolve to an array, or the maximum of this expression and the given value.
Method mean Returns the average value in this expression, which must resolve to a numeric array.
Method millisecond Returns the millisecond portion of this date expression (in UTC) as an integer between 0 and 999.
Method min Returns the minimum value of either this expression, which must resolve to an array, or the minimum of this expression and the given value.
Method minute Returns the minute portion of this date expression (in UTC) as a number between 0 and 59.
Method month Returns the month of this date expression (in UTC) as a number between 1 and 12.
Method pow Raises this expression, which must resolve to a numeric value, to the given power, self ** power.
Method prepend Prepends the given value to this expression, which must resolve to an array.
Method re_match Performs a regular expression pattern match on this expression, which must resolve to a string.
Method reduce Applies the given reduction to this expression, which must resolve to an array, and returns the single value computed.
Method replace Replaces all occurrences of old with new in this expression, which must resolve to a string.
Method reverse Reverses the order of the elements in the expression, which must resolve to an array.
Method round Rounds this expression, which must resolve to a numeric value, at the given decimal place.
Method rsplit Splits this expression, which must resolve to a string, by the given delimiter.
Method rstrip Removes whitespace characters from the end of this expression, which must resolve to a string.
Method second Returns the second portion of this date expression (in UTC) as a number between 0 and 59.
Method set_equals Checks whether this expression, which must resolve to an array, contains the same distinct values as each of the given array(s) or array expression(s).
Method set_field Sets the specified field or embedded field of this expression, which must resolve to a document, to the given value or expression.
Method sin Computes the sine of this expression, which must resolve to a numeric value, in radians.
Method sinh Computes the hyperbolic sine of this expression, which must resolve to a numeric value, in radians.
Method sort Sorts this expression, which must resolve to an array.
Method split Splits this expression, which must resolve to a string, by the given delimiter.
Method sqrt Computes the square root of this expression, which must resolve to a numeric value.
Method starts_with Determines whether this expression, which must resolve to a string, starts with the given string or string(s).
Method std Returns the standard deviation of the values in this expression, which must resolve to a numeric array.
Method strip Removes whitespace characters from the beginning and end of this expression, which must resolve to a string.
Method strlen Computes the length of this expression, which must resolve to a string.
Method substr Extracts the specified substring from this expression, which must resolve to a string.
Method sum Returns the sum of the values in this expression, which must resolve to a numeric array.
Method switch Applies a switch statement to this expression, which effectively computes the given pseudocode:
Method tan Computes the tangent of this expression, which must resolve to a numeric value, in radians.
Method tanh Computes the hyperbolic tangent of this expression, which must resolve to a numeric value, in radians.
Method to_bool Converts the expression to a boolean value.
Method to_date Converts the expression to a date value.
Method to_double Converts the expression to a double precision value.
Method to_int Converts the expression to an integer value.
Method to_string Converts the expression to a string value.
Method trunc Truncates this expression, which must resolve to a numeric value, at the specified decimal place.
Method type Returns the type string of this expression.
Method union Computes the set union of this expression, which must resolve to an array, and the given array(s) or array expression(s).
Method unique Returns an array containing the unique values in this expression, which must resolve to an array.
Method upper Converts this expression, which must resolve to a string, to uppercase.
Method week Returns the week of the year of this date expression (in UTC) as a number between 0 and 53.
Method year Returns the year of this date expression (in UTC).
Property is_frozen Whether this expression's prefix is frozen.
Method _freeze_prefix Undocumented
Method _function Undocumented
Method _let_in Undocumented
Instance Variable _expr Undocumented
Instance Variable _prefix Undocumented
def __init__(self, oid): (source)
def to_mongo(self, prefix=None): (source)

Returns a MongoDB representation of the ObjectId.

Parameters
prefix:Noneunused
Returns
a MongoDB expression