Module: Mongoid::Extensions::Vector
- Defined in:
- lib/mongoid/extensions/vector.rb
Overview
Adds type-casting behavior to BSON::Vector class so that a field
declared with type: BSON::Vector is stored as a BSON binary of the
vector subtype and read back as a BSON::Vector.
Querying by an exact vector value (e.g. where(embedding: vector)) is
not supported: BSON::Vector subclasses Array, so the criteria selector
treats it as a list of elements rather than a scalar. Use Atlas Vector
Search ($vectorSearch) for similarity queries on vector fields.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#mongoize ⇒ BSON::Binary | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#mongoize ⇒ BSON::Binary | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
21 22 23 |
# File 'lib/mongoid/extensions/vector.rb', line 21 def mongoize BSON::Vector.mongoize(self) end |