Skip to content

Commit

Permalink
Added ability to query for field equal to null
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbischof committed Apr 4, 2014
1 parent 67a2494 commit c5cfbb7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shock-server/controller/node/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func (cr *NodeController) ReadMany(ctx context.Context) error {
if value != "" {
if numValue, err := strconv.Atoi(value); err == nil {
q["$or"] = ListOfMaps{{keyStr: value}, {keyStr: numValue}}
} else if value == "null" {
q["$or"] = ListOfMaps{{keyStr: value}, {keyStr: nil}}
} else {
q[keyStr] = value
}
Expand All @@ -77,6 +79,8 @@ func (cr *NodeController) ReadMany(ctx context.Context) error {
if value != "" {
if numValue, err := strconv.Atoi(value); err == nil {
q["$or"] = ListOfMaps{{key: value}, {key: numValue}}
} else if value == "null" {
q["$or"] = ListOfMaps{{key: value}, {key: nil}}
} else {
q[key] = value
}
Expand Down

0 comments on commit c5cfbb7

Please sign in to comment.