diff --git a/pkg/expr/mongo.go b/pkg/expr/mongo.go
index 84471ccec2dcc526bd2d588bfd138d028c0202b6..08a33e0fc999ecd5c7aba566097d33c57b53e2b0 100644
--- a/pkg/expr/mongo.go
+++ b/pkg/expr/mongo.go
@@ -43,7 +43,6 @@ func convertToMongo(ctx context.Context, tree *parser.Tree, env map[string]inter
 
 	env[EnvContextKey] = ctx
 	config := GetDefaultConfig(env)
-	config.Visitors = append(config.Visitors, notinPatcher{})
 
 	for _, op := range ops {
 		op(config)
@@ -207,14 +206,14 @@ func (c *compiler) ConstantNode(node *ast.ConstantNode) interface{} {
 }
 
 func (c *compiler) UnaryNode(node *ast.UnaryNode) interface{} {
-	op := c.compile(node.Node)
-
 	switch node.Operator {
-
 	case "!", "not":
-		return bson.M{"$not": op}
-	case "":
-		return op
+		nodeIn, ok := node.Node.(*ast.BinaryNode)
+		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)}}
 	default:
 		panic(fmt.Sprintf("unknown operator (%v)", node.Operator))
 	}
@@ -642,25 +641,3 @@ func (c *compiler) PairNode(node *ast.PairNode) interface{} {
 	//c.compile(node.Key)
 	//c.compile(node.Value)
 }
-
-// notinPatcher проходит по лексемам ast-дерева
-// и объединяет лексемы "not" и "in" в "not in"
-type notinPatcher struct{}
-
-func (t notinPatcher) Visit(node *ast.Node) {
-	nodeNot, ok := (*node).(*ast.UnaryNode)
-	if !ok || nodeNot.Operator != "not" {
-		return
-	}
-
-	nodeIn, ok := nodeNot.Node.(*ast.BinaryNode)
-	if !ok || nodeIn.Operator != "in" {
-		return
-	}
-	
-	nodeNot.Operator = ""
-	ast.Patch(node, nodeNot)
-
-	nodeIn.Operator = "not in"
-	ast.Patch(&nodeNot.Node, nodeIn)
-}
\ No newline at end of file