Skip to content

Commit f6e56ff

Browse files
committed
Readme.md. Add warning about querying nil value attributes
1 parent 10e053d commit f6e56ff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,27 @@ User.where(name: 'Mike').where('name.begins_with': 'Ed')
544544

545545
the first one will be ignored and the last one will be used.
546546

547+
**Warning:** There is a caveat with filtering documents by `nil`
548+
value attribute. By default Dynamoid ignores attributes with `nil`
549+
value and doesn't store them in a DynamoDB document. This behavior
550+
could be changed with `store_attribute_with_nil_value` config option.
551+
552+
If Dynamoid ignores `nil` value attributes `null`/`not_null` operators
553+
should be used in query:
554+
555+
```ruby
556+
Address.where('postcode.null': true)
557+
Address.where('postcode.not_null': true)
558+
```
559+
560+
If Dynamoid keeps `nil` value attributes `eq`/`ne` operators
561+
should be used instead:
562+
563+
```ruby
564+
Address.where('postcode': nil)
565+
Address.where('postcode.ne': nil)
566+
```
567+
547568
#### Limits
548569

549570
There are three types of limits that you can query with:

0 commit comments

Comments
 (0)