Git Product home page Git Product logo

arangoclient.net's Introduction

ArangoDB .Net client driver

Main features

  • Linq to Aql
  • Change Tracking
  • Asynchronous and Synchronous API
  • Stream data with IEnumerable or IAsyncEnumerator

Install

dotnet add package ArangoDB.Client

Tutorial

C# client in 10 minutes will give you a quick tutorial on how client works.


Please open an issue if you need an api that doesnt implemented yet.

arangoclient.net's People

Contributors

dependabot[bot] avatar gitter-badger avatar jjchiw avatar jmcdaniel83 avatar ra0o0f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arangoclient.net's Issues

VelocyStream support

Hi,

I'm working the Velocypack .NET implementation for ArangoDB .NET drivers, based on java driver. if you interested it such as change protocol to VelocyStream instead of HTTP, please check out my project.
nevermind main project called ArangoDB.NET, it's just Java driver migration and no plan to solve yet.

Thanks.
Composite

Upsert always insert

Hi,
I'm using the driver with arangodb 3.0
I use this code to upsert my data:

           var insert = new Account
            {
                Email = "[email protected]",
                FirstName = "Adam",
                LastName = "Smith"
            };

            var update = new Account
            {
                Email = "[email protected]",
                FirstName = "John",
                LastName = "Peterson"
            };

            using (var arangoDatabase = new ArangoDatabase(new DatabaseSharedSetting()
            {
                Url = "http://127.0.0.1:8529/",
                Database = "_system",
                Credential = new NetworkCredential()
                {
                    UserName = "root",
                    Password = "xxxxxkkkk"
                }
            }))
            {
                arangoDatabase.Query()
                    .Upsert(_ => new Account() {Email = insert.Email},
                        _ => insert, ((aql, x) => update))
                        .In<Account>()
                        .Execute();
            }

If "[email protected]" doesn't exist. It will be inserted, that's OK.
But next time, as "[email protected]" exists, it throws me an exception: unique constraint violated (while executing). ErrorNumber: 1210 HttpStatusCode: 409

Can you help me to solve this problem please ?
Thank you,

OData support

hey, we are trying to use library with OData WebApi controllers. It partially works for some of the OData query options but some are throwing exceptions.

Let's say we have following People collection in arango db:

[{"Id":1,"LastName":"a"},{"Id":2,"LastName":"b"},{"Id":3,"LastName":"c"}]

then, in C# we have

[CollectionProperty(CollectionName = "People")] public class Person { [Key] public int Id { get; set; } public string LastName { get; set; } }

which we expose on OData controller as

    [HttpGet]
    [EnableQuery]
    public IHttpActionResult Get(ODataQueryOptions<Person> queryOptions)
    {
        var db = new ArangoDatabase("http://127.0.0.1:8529", "DBName");
        IQueryable<Person> people= db.Query<Person>();

        return Ok(people);
    }

This works fine with OData top/skip/orderby query options e.g.
http://localhost/people?$top=2&$skip=1$orderby=LastName

but we get exceptions when using other OData query options like count or select e.g

Count:
OData query is:
http://localhost/people?$count=true

exception is:

{ "message": "Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'Id', line 1, position 17.", "type": "ArangoDB.Client.Common.Newtonsoft.Json.JsonSerializationException",

When stepping through the code I got to the point which causes exception and same exception could be replicated by trying to execute following query:

db.Query().LongCount();

so it looks like LongCount() not working properly is root cause of this particular issue?

Select
OData query is:
http://localhost/people?$select=LastName

and exception is:

"The expression 'IIF(([_1] == null), null, Convert([_1].Id))' (type: System.Linq.Expressions.ConditionalExpression) is not supported by ArangoDB LINQ provider."

Are we missing something or is OData not fully supported?
I didn't paste in full stack traces as they're lengthy but let me know if you want it and I'll supply them.

Null ref exception when trying to insert edge to the graph

When inserting new edge to the graph null reference exception throw when trying to set edge document _from and _to fields in DocumentIdentifierModifier.Modify method.

Adding these fields to edge document results in a different exception as ArangoEdgeDocument.InsertAsync adds these fields explicitly to edge document JObject representation

var jObject = new DocumentSerializer(db).FromObject(document);
jObject.Add("_from", JToken.FromObject(from));
jObject.Add("_to", JToken.FromObject(to)); 

Upsert?

Hey

I was wondering if the UPSERT command will be implemented in the QueryableExtensions? As far as I can see, there is currently no type-safe way to go around with an "update-if-exists,-else-insert" scenario using the arangoclient... I might be wrong(?)

/Julian

One to many query?

I'm looking through linq provider unite tests and I can't see any example of using Horizontal lists (https://docs.arangodb.com/AqlExamples/Join.html).

For example, I have addresses collection

[{"Id":1},{"Id":2] 

And people collection:

[{"AddressId":1,"LastName":"a"},{"AddressId":2,"LastName":"b"},{"AddressId":1,"LastName":"c"}]  

I would like to get resulting object:

[
    {
        "address": {
            "Id" : 1
            "People": [
                {
                    "LastName" : "a"
                },
                {
                    "LastName" : "c"
                }
            ]
        }
    }
    {
        "address": {
            "Id" : 2
            "People": [
                {
                    "LastName" : "b"
                }
            ]
        }
    }
]

in AQL I would write:

FOR address IN addresses
    RETURN {
        address: address,
        people: (
            FOR person IN people
                FILTER person.AddressId == address.Id
                    RETURN person
        )
    }

Is this supported in linq provider?

Traversal result causes [1205] illegal document handle (while executing)

Took some time to find the cultprit, but here it is:

This code

var noteScope = _db.Query()
               .For(a => AQL.Traversal<Target, Relates>(startAt, EdgeDirection.Inbound))
               .For(target => AQL.Edges<Relates>(target.Vertex.Id, EdgeDirection.Inbound))
               .Filter(relation => relation.Label == Relates.NoteAttachementLabel )
               .Return(relation => relation.Out);

now (after upgrade to 0.7.2.3) generates this query:

for `n` in `Note`  
filter  (  `n`.`_id` in (  
for `target` in  traversal(  `Target` ,  `Relates` ,  "Target/roomstay:1001,1"  ,  "inbound"  )  
for `relation` in  edges(  `Relates` ,  `target`.`Vertex` .`_id`  ,  "inbound"  )  
filter  (  `relation`.`Label`  ==  "Note attached to"  )  
return  `relation`.`_from`  )  
and  (  length(  intersection(  `n`.`Relevances`  ,  ["Check In","Service"]  )  )  >  0  )  )  
return  `n`

which throws "[1205] illegal document handle (while executing)" because of "target.Vertex ._id" (which should be "target.vertex ._id", small 'v' in vertex)

Support Polymorphism

I can't see any way to work with class hierarchies.

For example, let's say I had an Animal class, and Dog and Cat subclasses. Working with MongoDB I'd create an Animal collection, then I would insert Dog and Cat instances and a type discriminator field would automatically be added. I could then use Linq's .OfType<Dog> to query specifically on dogs, for example.

AFAICS, arangoclient doesn't support polymorphism?

Collection index'es?

Hello again :3
Just wondering if there is currently, or if there will be, a way to state indexes for collections?
For example IArangoCollection.EnsureHashIndex(params string[] fields, bool? sparse = default(bool)) and IArangoCollection.EnsureUniqueConstraint(params string[] fields, bool? sparse = default(bool)) etc.

Is [DocumentProperty(IgnoreProperty = true)] not supposed to ignore document properties?

Consider the following 4 types:

public abstract class ContactInfo {
  public SomeEnum SomeEnumValue { get; set; }
  [DocumentProperty(IgnoreProperty = true)]
  public abstract string ContactValue { get; }
}

public class ContactEmailInfo : ContactInfo {
  public string EmailAddress { get; set; }
  [DocumentProperty(IgnoreProperty = true)]
  public override string ContactValue => EmailAddress;
}

public class ContactPhoneInfo : ContactInfo {
  public ulong PhoneNumber { get; set; }
  public string Region Code { get; set; }
  [DocumentProperty(IgnoreProperty = true)]
  public override string ContactValue => EmailAddress;
}

public class UserDocument {
  public UserDocument() {
    ContactEmails = new List<ContactEmailInfo>();
    ContactPhones = new List<ContactPhoneInfo>();
  }
  public IList<ContactEmailInfo> ContactEmails { get; }
  public IList<ContactPhoneInfo> ContactPhones { get; }
  [DocumentProperty(IgnoreProperty = true)]
  public IReadOnlyCollection<UserContactInfo> ContactInfos =>
    new ReadOnlyCollection<UserContactInfo>(ContactEmails
      .Cast<UserContactInfo>().Union(ContactPhones).ToArray());
}

When using the client to save a UserDocument, its UserInfos array is being stored in the db json document, essentially duplicating items that are already in the UserEmails and UserPhones arrays. Furthermore each array item has its ContactValue serialized, again duplicating data that is already stored in other differently-named properties.

Am I misunderstanding the API for ignoring CLR properties when serializing to arango via this client, if such a thing is possible?

All enumeration of queries throws ArangoServerException( ErrorNumber : 17, HttpStatusCode : 400 )

It seems theres a problem with cursors (guessing).
For for reproduction:

        [Test]
        public void CanQueryDB()
        {
            using (var db = new ArangoDatabase("http://localhost:8529", database: "test"))
            {
                var exDb = db.ListDatabases();
                if (exDb.Contains("test"))
                {
                    db.DropDatabase("test");
                }
                db.CreateDatabase("test");


                var obj = new SomeClass() {Key = "1", Text = "Heyheyhey!"};
                db.Insert<SomeClass>(obj);
                Assert.That(() =>

                    //How else would you do it?
                    db.Query<SomeClass>().Where(x => true).ToArray()

                    , Throws.Nothing);
            }
        }

        public class SomeClass
        {
            [DocumentProperty(Identifier = IdentifierType.Key)]
            public string Key;
            public string Text;
        }

When runnin Arango 2.7.0 or 2.6.9 (that's the versions I've tried), the following is thrown:

Message:    
ArangoDB.Client.ArangoServerException : expecting non-zero value for <batchSize>. ErrorNumber: 17 HttpStatusCode: 400

Stacktrace:
at ArangoDB.Client.BaseResultAnalyzer.ThrowIfNeeded(BaseResult baseResult)
   at ArangoDB.Client.Cursor.CursorAsyncEnumerator`1.<SetCurrent>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ArangoDB.Client.Cursor.CursorAsyncEnumerator`1.<MoveNextAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at ArangoDB.Client.Utility.TaskUtils.ResultSynchronizer[T](Task`1 task)
   at ArangoDB.Client.Cursor.CursorEnumerator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Xpectra.ReadServiceTests.Contexts.NotesReadModel.NotesEventHandlerTest.<CanQueryDB>b__6_0() in C:\Code\Xpectra\Tests\Xpectra.ReadServiceTests\Contexts\NotesReadModel\NotesEventHandlerTest.cs:line 74
   at NUnit.Framework.Constraints.GenericInvocationDescriptor`1.Invoke()
   at NUnit.Framework.Constraints.ExceptionInterceptor.Intercept(Object invocation)

I've also asked for help StackOverflow ( http://stackoverflow.com/questions/33102920/how-can-i-avoid-error-17-when-querying-with-arangodb-net-client ) - but maybe it belongs here?

/Julian

Arango db field casing issue with linq queries

hey, first of all, thanks for cool library :)

Down to business: in arango, I've got Person collection with last name fields (notice second object's field starts with lower case):
[{"LastName":"a"},{"lastName":"b"},{"LastName":"c"}]

In C#, I've got Person class with LastName field.

public class Person
{
    public string LastName;
}

Now, db.Query().ToList() returns all 3 objects with LastName properly initialized with respective values. However, linq query db.Query().Where(e => AQL.Contains(e.LastName, "b")).ToList() doesn't return anything. I'm guessing this is not intentional?

IDocumentCollection.Collection returns invalid JSON when using JObject as a type

Hi,
I have following content stored in a collection:
arango

Then, I do

db.Collection(Rule.RULES_COLLECTION_NAME) .All<JObject>() .ToList()

(JObject comes from ArangoDB.Client.Common.Newtonsoft.Json.Linq)

which returns:
code

which is not a valid JSON (see double curly braces surrounding each object). Am I missing something or is this a bug?

ID, Pass

Hello, it would be nice if auth would be implemented, because I will use this database in production.

I think your plugin is nicer than "ArangoDB-NET", because you support Async.

Arangodb Transaction

Hi @ra0o0f

Could you please provide example of arango transaction with both read and write actions?

db.ExecuteTransaction(...)

Thanks

Question: How do you query/traverse graphs?

Hey

I'm trying to write a query for an assertion for the simplest possible relation:

"target" --[isPartOf]-->"target"

, with the ability of a "target" to be part of 0-* other targets

I've got the insertion of document/nodes right (and asserted with query) - how would you (in psudocode) write the query that Asserts the relation exists?

The model so far looks like this:

    public class Target
    {
        [DocumentProperty(Identifier = IdentifierType.Key)]
        public string Key;

        //Is this part of the solution?
        //[DocumentProperty(Identifier = IdentifierType.EdgeTo)]
        ///public string[] IsPartOf;

        public string EntityType;
        public string AggregateId;
    }

    public class IsPartOf
    {
        //What would go here? Nothing?
    }

Looking at the ArangoDB.Client.Test, "Product" has a "Category" property, which reminds me of an EF navigationProperty, but I can't seem to find code or documentation about how to go around this...

Any hints or tips are much appreciated :)

/Julian

Problems using client in dnx project when running on mono

Just wondering if this is a known issue, or if there are any workarounds. I have a .NET vNext project targeting dnx451, and the client works as expected when running on windows. However when running the same app natively on a mac, I am running into an InvalidOperationException:

Operation is not valid due to the current state of the object

This seems to happen whenever trying to invoke any methods against the API. For example, the following code will throw on the ListDatabases() method:

using (var db = new ArangoDatabase("http://localhost:8529", "_system")) {
  var dbs = db.ListDatabases();
}

...however other method invocations result in the same exception & message. If you need to see a full stacktrace please let me know. In the meantime, here is a brief one:

Unhandled Exception:
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
  at System.Net.Http.HttpClientHandler.set_Proxy (IWebProxy value) <0x10a5c3ce0 + 0x0008c> in <filename unknown>:0
  at ArangoDB.Client.Http.HttpConnection+<>c.<.cctor>b__10_0 () <0x10a5c3830 + 0x000eb> in <filename unknown>:0
  at System.Lazy1[T].CreateValue () <0x104f87bf0 + 0x00174> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---

There are other sections where it looks like the exception was wrapped and rethrown by the task awaiter, but here are the relevant lines from the Arango client lib:

at ArangoDB.Client.Http.HttpCommand+<SendCommandAsync>d__33.MoveNext () <0x10a5bac50 + 0x002ab> in <filename unknown>:0
...
at ArangoDB.Client.Http.HttpCommand+<RequestGenericListResult>+d__29`2[TResult.TDeserialize].MoveNext () <0x10a5b9bc0 + 0x002ac> in <filename unknown>:0
...
at ArangoDB.Client.ArangoDatabase<ListDatabasesAsync>d__50.MoveNext () <0x10a5b78f0 + 0x002b0> in <filename unknown>:0

specific release for .net 4.5

System.Net.ServicePointManager cant be used in portable class library. so unlike in .net 4.5, client cant increase ServicePoint.ConnectionLimit or other properties for performance tuning.

Uri baseUri = new Uri(db.Settings.Url);
var servicePoint = ArangoDatabase.ClientSetting.Proxy != null ? ServicePointManager.FindServicePoint(baseUri, ArangoDatabase.ClientSetting.Proxy) :
ServicePointManager.FindServicePoint(baseUri);
servicePoint.UseNagleAlgorithm = false;
servicePoint.Expect100Continue = false;
servicePoint.ConnectionLimit = 256;

so a specific release for .net 4.5 is needed

AQL.document(id) function implementation

Is there implementation of AQL's DOCUMENT function which returns document by id?

Basically every time you're using graph operations such as GRAPH_NEIGHBORS, GRAPH_COMMON_NEIGHBORS etc. you're getting list of handles back and in order to get the actual documents you need to perform join on id with vertex collections whereas AQL natively supports document function which returns document by handle.

Am I missing something?

Thanks

Can't set proxy to ArangoDatabase

Hi!

I really like what you're doing here, I'm starting to test the driver and It's awesome!

I just have a little question, why the property ClientSetting in ArangoDatabase is private? https://github.com/ra0o0f/arangoclient.net/blob/master/ArangoDB.Client/ArangoDatabase.cs#L31

I'm trying to see all the http requests that are made to arangodb using fiddler, so I have to put a proxy, I've changed the Property to public in order to set the fiddler proxy

ArangoDatabase.ClientSetting = new ClientSetting {
    Proxy = new WebProxy("http://127.0.0.1:8888", false),
};

using (ArangoDatabase db = new ArangoDatabase(url: "http://localhost.fiddler:8529", database: "myDatabase"))
{ ... }

Even is just removing the private keyword from that line, would you like a PR?

I would really like to help to make this library better with all the functions that exists in arangodb...

Here is a thread talking about the .net driver for arangodb in the googlegroups https://groups.google.com/forum/#!searchin/arangodb/.net/arangodb/Y1fWIPcE8Zs/mG9YxRvzJnIJ

You should post your driver there. :)

Scalar-Value Function

Is there any method to return as Scalar Value?

for example: I would like to check the data is exist. Now I am checking as:

if (_arangoDb.Document<Resource>(Id) == null)

But it returns the whole object.
Is there any better way?

Thanks.

How to execute pure AQL queries?

I am new to ArangoDB and I find it hard to write complex queries with LINQ, and would like to execute queries in clean AQL.
How can it be done within this library?

For example, I want to retrieve all articles that belong to groups current user is member of.
My LINQ query looks like

var query = from p in db.Query<Person>()
                where p.Name == "Bob"
                from g in db.Query<Group>()
                from memberOf in db.Query<MEMBER_OF>()
                where memberOf.Person == p.Id
                where g.Id == memberOf.Group
                from a in db.Query<Article>()
                from childOf in db.Query<CHILD_OF>()
                where childOf.Child == a.Id && childOf.Parent == g.Id
                select a;

And my AQL looks like:

FOR u IN People FILTER u.Name == "Bob"
    FOR g IN OUTBOUND u MEMBER_OF
        FOR a IN INBOUND g CHILD_OF RETURN a

Documents filtering by enum value

Consider the document below:

public class Document
{
    ...
    [JsonConverter(typeof(StringEnumConverter))]
    public MyEnum EnumAttribute { get; set; }
    ...
}

public enum MyEnum
{
    Value1 = 1,
    Value2 = 2
}

When this document saved enum value correctly serialized to string.
But when performing query over Document collection and filtering by enum attribute enum serialized to int.

db.Query<Document>().Filter(x => x.EnumAttribute == MyEnum.Value1).Update(...)

If you explore query data

for `x` in `Document`  filter  (  (  `x`.`EnumAttribute`  ==  @P1  ) )  update `x` ...
@P1 = 1

Please advise.

Events before saving, deleting and Updating

What do you think about adding some events before save, delete and update document or edges.

An example there are classes that have properties like:

public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }

And every time you have to not forget to update those properties.

So I was thinking in adding events to ArangoDatabase to the file ArangoDocumentCommand.cs

This is a sample

...
public event EventHandler<ArangoDatabaseEventArgs> BeforeItemRemoved;
public event EventHandler<ArangoDatabaseEventArgs> BeforeItemSaved;
public event EventHandler<ArangoDatabaseEventArgs> BeforeItemUpdated;

public DocumentIdentifierResult Save<T>(object document, bool? createCollection = null, bool? waitForSync = null)
{
    Fire(BeforeItemAdded, item: document);

    return Collection<T>().Save(document, createCollection, waitForSync);
}

protected virtual void Fire(EventHandler<ArangoDatabaseEventArgs> @event, object item)
{
    if (@event != null)
    {
        var args = new ArangoDatabaseEventArgs { Item = item };
        @event(this, args);
    }
}

public class ArangoDatabaseEventArgs : EventArgs
{
    public object Item { get; set; }
}
...

And the user of the driver will have to assign the events like this

var db = new ArangoDatabase("http://localhost:8529", "mydatabase")

db.BeforeItemAdded += (obj, evt) =>
{
    if (evt.Item is ICreatedAt) {
        (evt.Item as ICreatedAt).CreatedAt = DateTime.UtcNow;
    }

    if (evt.Item is IModifiedAt) {
        (evt.Item as IModifiedAt).ModifiedAt = DateTime.UtcNow;
    }
};

db.BeforeItemUpdated += (obj, evt) =>
{
    if (evt.Item is IModifiedAt) {
        (evt.Item as IModifiedAt).ModifiedAt = DateTime.UtcNow;
    }
};

So in every save or update, you will have the ModifiedAt property updated

When creating Graph programmatically Vertex defenition is empty

I'm using below command to create arango graph

ArangoGraph.Create(new[]
{
    new EdgeDefinitionData
    {
        Collection = "EdgeCollection",
        From = new[] {"User"},
        To = new[] {"User"}
    }
});

If I check graph definition in arango web UI vertex collection is empty.

How to specify vertex collection?

Question about async querying.

So far this library is perfect when inserting, updating or deleting objects asynchronously, however, when I try and do FirstOrDefaultAsync() I get an error that the collection doesn't support it. Am I missing something?

.Net Core

Does arangoclient.net support .Net Core 1.0?

Thank you very much.

DistinctBy feature.

Hi,
is available a DistinctBy feature in order to get a list of objects, but distincted by some properties,
or can i get this by grouping objects by all their atreibutes and taking the first object for each group?

Thank you.

How to create Readonly property?

Hi,

I'm trying to create readonly property in my Class:

public class Person
    {
        public string Key { get; set; }
        public string FirstName { get; set; }
        public string  LastName { get; set; }
        public string  DisplayName { get { return FirstName + " " + LastName; } }
    }

But DisplayName is created in the ArangoDb. Please advice!

Thanks!

Question about array querying

What's the easiest way to query an array within an object so:

{
Name: "Something",
Arr: [
{ name: "somethingA" },
{ name: "somethingB" }
]
}

Say I want to find all items where name == "somethingB", how would I do that?

I tried using things.Where(x => x.Objects.Any(y => y.name == "somethingB")) but it returns true no matter what

Thanks!

Why Newtonsoft.Json package is copy-pasted instead of dependency?

Even if new version of Newtonsoft.Json introduces breaking changes it could be implemented as package dependency.
That shouldn't be an issue as Newtonsoft.Json is quite stable.
And because it is very popular many .NET projects already have references to it. So it causes duplication and it is also impossible to use existing JsonConverters both for normal and copy-pasted Newtonsoft.Json.
Are there some problems behind current decision? I or someone else could contribute to solving them.

Cannot create new Edge

I've been testing this driver and made a sample app, where I defined my models. Then I tried to execute this code:
await _db.InsertEdgeAsync<HAS_PROFILE, UserAccount, UserProfile>(userAccount.Id, userProfile.Id, new HAS_PROFILE());

But got

unknown path '/_api/edge?collection=HAS_PROFILE&createCollection=True&waitForSync=False&from=UserAccounts%2F617261&to=UserProfiles%2F617265'. ErrorNumber: 404 HttpStatusCode: 404

Is it possible to create edges with this driver? If so, how it supposed to be done? I could not find any documentation on GitHub or examples\tests in the source

Two questions: Geters/seters necesarry? And is type byte[] supported in class?

Hello! I don't know where else I can ask you this, so I will ask here.

1.Are getters/setters necesary in object definition to use with your ArangoDB plugin?

  1. Is byte[] supported in class/model? I am asking, because

    db.Document(ID, baseResult = resHandler("getPlayer"))

is giving me exception "Operation is not valid due to the current state of the object". Async version gives me same exception.

Thanks!

Next branch is missing GenericStreamContent.cs file

I've pulled the next branch to see what new features are going to be added in the upcoming version. The sources don't compile however due to a missing file GenericStreamContent.cs under ArangoDB.Client and HttpConnection class does depend on that.

OutOfMemoryException when enumerating over documents due to DocumentTracker

ArangoDB 2.8.2 on Windows 7 x64. When I try to iterate over all documents in a collection of just under 10M documents (14 columns per document) the my program uses a lot of memory and ultimately crashes with OutOfMemoryException, even though I don't keep the loaded objects. Code:

            using (var db = new ArangoDatabase("http://localhost:8529", "Jabba"))
            {
                var entities = db.Collection("Entities");
                var cursor = entities.All<Entities>(limit: 1000000, batchSize: 1000);

                foreach (var value in cursor.AsEnumerable())
                {
                    // Do some stuff
                }
            }

Profiling shows that the DocumentTracker tracker appears to be keeping all loaded objects in memory. If I replace it with a stub (FakeDocumentTracker) this problem goes away.

I'm not sure what DocumentTracker is supposed to do, but please provide a way to disable it. Perhaps it should even be disabled by default, given this problem.

Could you please check if InsertEdge is broken right now?

Hello,

could you please check if InsertEdge is broken right now?
I am very confident that I am using it right but it gives me the following error:

An unhandled exception of type 'ArangoDB.Client.ArangoServerException' occurred in ArangoDB.Client.dll

Additional information: unknown path '/_api/edge?collection=VoltageLevelOfSubstation&createCollection=True&waitForSync=False&from=VoltageLevel%2F4419f583-13f4-4577-b95e-09269e2c4e2f&to=Substation%2F1fc54ab8-85c1-42a3-8605-0bcf8ac3d09d'. ErrorNumber: 404 HttpStatusCode: 404

Note that I am using self-generated Guids as keys. All the "VoltageLevel" and "Substation" instances as well as all document and edge collections were successfully inserted before.

Sadly I couldn't find a test in the sources for InsertEdge to verify that it's basically working. Maybe you could add one.

Thanks in advance and best regards
Patrick

Sanitize transaction-scripts?

I've just figured out why i keep getting the following exception:

ArangoDB.Client.ArangoServerException : missing/invalid action definition for transaction - Uncaught SyntaxError: Unexpected token ILLEGAL - SyntaxError: Unexpected token ILLEGAL
at Function (native)
at post_api_transaction (c:\Code\Xpectra\Dependencies\ArangoDB-2.7.1-win64\share\arangodb\js\actions\api-transaction.js:268:16)
at Function.actions.defineHttp.callback (c:\Code\Xpectra\Dependencies\ArangoDB-2.7.1-win64\share\arangodb\js\actions\api-transaction.js:288:11)
. ErrorNumber: 10 HttpStatusCode: 400

... The input is not sanitized - even linebreaks in the script causes this exception.

It works when regex.replace'ing @"[^\u0000-\u007F]" and @"\r\n?|\n" with string.Empty.

This is a warning for others searching for "Unexpected token ILLEGAL", and a suggestion to have the client-framework handle input sanitazion :)

/Julian

Documentation for existing API

Hi @ra0o0f ,
Is there any proper documentation available that demonstrates how to use this client. I am more interested in using this client than the others because of the Async API and this Client looks really neat. But at the moment I am just not able to get this to work. On the website there is just a general implementation but that is not the case in most real world projects.

It would be really helpful if we have some docs that shows the usage of the various attributes and how to use the models with the client functions etc. This would help people to get started and upgrade as new versions roll out.

Thanks

JsonProperty attribute is ignored in 0.7.4

I declare my models with JsonProperty attribute like this:

[JsonProperty(NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool? SomeVariable {get; set; }

It worked fine prior 0.7.4 - documents created in the database didn't have fields with nulls.
But now all of the fields are created in the database, even if the value is null. It seems like these JsonProperty attributes are ignored.

I tried it with bool? and string and it doesn't work. But it does work with List<T> though

How can I create composite key?

I have a resource class and would like to create composite key as below:

public class Resource { [Key, Column(Order = 1)] public Guid ResourceId {get; set;} [Key, Column(Order = 2)] [MaxLength(5)] public string Locale {get; set;} public string ResourceName {get; set;} }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.