Get returns the value of the given field path in the document.
(fp []string)
| 102 | |
| 103 | // Get returns the value of the given field path in the document. |
| 104 | func (d Document) Get(fp []string) (any, error) { |
| 105 | d2, err := d.getDocument(fp[:len(fp)-1], false) |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | return d2.GetField(fp[len(fp)-1]) |
| 110 | } |
| 111 | |
| 112 | func (d Document) structField(name string) (reflect.Value, error) { |
| 113 | // We do case-insensitive match here to cover the MongoDB's lowercaseFields |