Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public async Task AnalyzersViews()
        {
            var analyzers = await Arango.ListAnalyzersAsync("test");

            await Arango.CreateAnalyzerAsync("test", new ArangoAnalyzer
            {
                Name       = "text_de_nostem",
                Type       = "text",
                Properties = new ArangoAnalyzerProperties
                {
                    Locale    = "de.utf-8",
                    Case      = "lower",
                    Accent    = false,
                    Stopwords = new List <string>(),
                    Stemming  = false
                },
                Features = new List <string> {
                    "position", "norm", "frequency"
                }
            });


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

            await Arango.CreateViewAsync("test", new ArangoView
            {
                Name  = "TestView",
                Links = new Dictionary <string, ArangoLinkProperty>
                {
                    ["collection"] = new ArangoLinkProperty
                    {
                        Fields = new Dictionary <string, ArangoLinkProperty>
                        {
                            ["Name"] = new ArangoLinkProperty
                            {
                                Analyzers = new List <string> {
                                    "text_de_nostem"
                                }
                            }
                        }
                    }
                }
            });

            await Arango.DropViewsAsync("test");

            await Arango.DeleteAnalyzerAsync("test", "text_de_nostem", true);
        }
Ejemplo n.º 4
0
        public async Task Collection()
        {
            await Arango.CreateCollectionAsync("test", "test", ArangoCollectionType.Document);

            await Arango.CreateDocumentAsync("test", "test", new
            {
                Key  = "abc",
                Name = "a"
            });

            var res = await Arango.UpdateDocumentAsync("test", "test", new
            {
                Key  = "abc",
                Name = "c"
            }, returnNew : true, returnOld : true);
        }
Ejemplo n.º 5
0
        public async Task Collection()
        {
            await Arango.CreateCollectionAsync("test", new ArangoCollection
            {
                Name       = "test",
                Type       = ArangoCollectionType.Document,
                KeyOptions = new ArangoKeyOptions
                {
                    Type          = ArangoKeyType.Padded,
                    AllowUserKeys = false
                }
            });

            await Arango.CreateDocumentAsync("test", "test", new
            {
                Name = "test"
            });
        }