Skip to content
Snippets Groups Projects
Commit 7e78eea4 authored by Danis Kirasirov's avatar Danis Kirasirov
Browse files

refactor

parent 6c9c2f17
No related branches found
No related tags found
No related merge requests found
...@@ -209,11 +209,11 @@ func (c *compiler) UnaryNode(node *ast.UnaryNode) interface{} { ...@@ -209,11 +209,11 @@ func (c *compiler) UnaryNode(node *ast.UnaryNode) interface{} {
switch node.Operator { switch node.Operator {
case "!", "not": case "!", "not":
nodeIn, ok := node.Node.(*ast.BinaryNode) nodeIn, ok := node.Node.(*ast.BinaryNode)
if !ok || nodeIn.Operator != "in" { if ok && nodeIn.Operator == "in" {
return bson.M{"$not": c.compile(node.Node)} return bson.M{c.identifier(nodeIn.Left): bson.M{"$nin": c.eval(nodeIn.Right)}}
} }
return bson.M{c.identifier(nodeIn.Left): bson.M{"$nin": c.eval(nodeIn.Right)}} return bson.M{"$not": c.compile(node.Node)}
default: default:
panic(fmt.Sprintf("unknown operator (%v)", node.Operator)) panic(fmt.Sprintf("unknown operator (%v)", node.Operator))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment