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

refactor

parent 6c9c2f17
Branches
Tags
No related merge requests found
......@@ -209,11 +209,11 @@ func (c *compiler) UnaryNode(node *ast.UnaryNode) interface{} {
switch node.Operator {
case "!", "not":
nodeIn, ok := node.Node.(*ast.BinaryNode)
if !ok || nodeIn.Operator != "in" {
return bson.M{"$not": c.compile(node.Node)}
if ok && nodeIn.Operator == "in" {
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:
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