Example #1
0
        public async Task QueryIntegerContains()
        {
            await Arango.CreateDatabaseAsync("test");

            await Arango.CreateCollectionAsync("test", "test", ArangoCollectionType.Document);

            await Arango.CreateDocumentsAsync("test", "test", new List <Entity>
            {
                new Entity {
                    Value = 1
                },
                new Entity {
                    Value = 2
                },
                new Entity {
                    Value = 3
                }
            });

            var select = new List <int> {
                1, 2
            };

            var res = await Arango.QueryAsync <Entity>("test", $"FOR e IN test FILTER e.Value IN {select} RETURN e");

            Assert.Equal(2, res.Count);
        }
Example #2
0
        public async Task StreamTransaction()
        {
            await Arango.CreateCollectionAsync("test", "test", ArangoCollectionType.Document);

            var t1 = await Arango.BeginTransactionAsync("test", new ArangoTransaction
            {
                Collections = new ArangoTransactionScope
                {
                    Write = new List <string> {
                        "test"
                    }
                }
            });

            await Arango.CreateDocumentsAsync(t1, "test", new List <Entity>
            {
                new Entity {
                    Value = 1
                },
                new Entity {
                    Value = 2
                },
                new Entity {
                    Value = 3
                }
            });

            await Arango.CommitTransactionAsync(t1);

            Assert.Equal(3, (await Arango.FindAsync <Entity>("test", "test", $"true")).Count);

            var t2 = await Arango.BeginTransactionAsync("test", new ArangoTransaction
            {
                Collections = new ArangoTransactionScope
                {
                    Write = new List <string> {
                        "test"
                    }
                }
            });

            await Arango.CreateDocumentsAsync(t2, "test", new List <Entity>
            {
                new Entity {
                    Value = 1
                },
                new Entity {
                    Value = 2
                },
                new Entity {
                    Value = 3
                }
            });

            await Arango.AbortTransactionAsync(t2);

            Assert.Equal(3, (await Arango.FindAsync <Entity>("test", "test", $"true")).Count);
        }