File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,12 +50,22 @@ public extension BSONDocument {
5050 // { <field>: { $eq: <value> } }
5151 guard case let . keyPath( keyPath) = predicate. left,
5252 let comparisonOperator = ComparisonQueryOperator ( predicate: predicate. type) ,
53- case let . value( value) = predicate. right,
5453 predicate. options. isEmpty,
55- predicate. modifier == nil ,
56- let valueBSON = try ? BSON ( attributeValue: value) else {
54+ predicate. modifier == nil else {
5755 return nil
5856 }
57+ let valueBSON : BSON
58+ switch predicate. right {
59+ case . keyPath:
60+ return nil
61+ case let . attribute( value) :
62+ guard let bson = try ? BSON ( attributeValue: value) else {
63+ return nil
64+ }
65+ valueBSON = bson
66+ case let . relationship( value) :
67+ valueBSON = BSON ( relationship: value)
68+ }
5969 self = [
6070 keyPath. rawValue: . document( [ comparisonOperator. rawValue: valueBSON] ) ]
6171 }
You can’t perform that action at this time.
0 commit comments