Example #1
0
        public BsonValue Execute(DbEngine engine, StringScanner s)
        {
            var col = this.ReadCollection(engine, s);
            var query = this.ReadQuery(s);

            return engine.Delete(col, query);
        }
Example #2
0
        public BsonValue Execute(DbEngine engine, StringScanner s)
        {
            var col   = this.ReadCollection(engine, s);
            var query = this.ReadQuery(s);

            return(engine.Delete(col, query));
        }
Example #3
0
        public void Delete_Node_Should_Remove_Its_Relations()
        {
            const string RelationLabel = "Left";
            const string FromNodeLabel = "Primitive";
            const string ToNodeLabel   = "Primitive1";
            var          engine        = new DbEngine();

            var nodeFrom = engine.AddNode(FromNodeLabel);
            var nodeTo   = engine.AddNode(ToNodeLabel);
            var relation = engine.AddRelation(nodeFrom, nodeTo, RelationLabel);

            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);
            engine.Delete(nodeFrom);
            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);

            var query = new Query(engine);
            var nodes = query.Match(new NodeDescription(ToNodeLabel));

            query.Execute();
            var node = nodes.Nodes.First();

            node.PullInRelations();
            Assert.AreEqual(node.InRelations.Count, 0);
        }
Example #4
0
        public void Delete_Node()
        {
            const string Label  = "Primitive";
            var          engine = new DbEngine();

            var node = engine.AddNode(Label);

            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);
            engine.Delete(node);
            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);

            var query      = new Query(engine);
            var foundNodes = query.Match(new NodeDescription(Label));

            query.Execute();
            Assert.AreEqual(foundNodes.Nodes.Count, 0);
        }
Example #5
0
        public void Delete_Relation()
        {
            const string RelationLabel = "Left";
            const string NodeFromLabel = "Primitive";
            const string NodeToLabel   = "Primitive1";
            var          engine        = new DbEngine();

            var nodeFrom = engine.AddNode(NodeFromLabel);
            var nodeTo   = engine.AddNode(NodeToLabel);
            var relation = engine.AddRelation(nodeFrom, nodeTo, RelationLabel);

            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);
            engine.Delete(relation);
            engine.SaveChanges();
            Thread.Sleep(ConsistencyDelayMs);

            var query = new Query(engine);
            var nodes = query.Match(new NodeDescription(NodeFromLabel));

            query.Execute();
            var node = nodes.Nodes.First();

            node.PullOutRelations();

            var query1 = new Query(engine);
            var nodes1 = query1.Match(new NodeDescription(NodeToLabel));

            query1.Execute();
            var node1 = nodes1.Nodes.First();

            node1.PullInRelations();

            Assert.AreEqual(node.OutRelations.Count, 0);
            Assert.AreEqual(node1.InRelations.Count, 0);
        }
Example #6
0
 public void Delete()
 {
     Db.Delete(this);
 }