在使用arangoDB .net客户端进行查询时,如何避免错误17?

时间:2015-10-13 12:37:47

标签: arangodb

我一直在期待"期待非零值。 ErrorNumber:17 HttpStatusCode:400"当我查询。我尝试尽可能接近the example实施它:

示例:

    [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<RelevanceContext>(obj);
            Assert.That(() =>

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

                , Throws.Nothing);
        }
    }

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

结果:

Test Name:  CanQueryDB
Test FullName:  Xpectra.ReadServiceTests.Contexts.NotesReadModel.NotesEventHandlerTest.CanQueryDB
Test Source:    C:\Code\Xpectra\Tests\Xpectra.ReadServiceTests\Contexts\NotesReadModel\NotesEventHandlerTest.cs : line 48
Test Outcome:   Failed
Test Duration:  0:00:02,313

Result StackTrace:  at Xpectra.ReadServiceTests.Contexts.NotesReadModel.NotesEventHandlerTest.CanQueryDB() in C:\Code\Xpectra\Tests\Xpectra.ReadServiceTests\Contexts\NotesReadModel\NotesEventHandlerTest.cs:line 60
Result Message: 
Expected: No Exception to be thrown
  But was:   (expecting non-zero value for <batchSize>. ErrorNumber: 17 HttpStatusCode: 400)
   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__5_0() in C:\Code\Xpectra\Tests\Xpectra.ReadServiceTests\Contexts\NotesReadModel\NotesEventHandlerTest.cs:line 60
   at NUnit.Framework.Constraints.GenericInvocationDescriptor`1.Invoke()
   at NUnit.Framework.Constraints.ExceptionInterceptor.Intercept(Object invocation)

我使用ArangoDB.Client v.7.2.2.1(nuget.org上的最新版本),并运行AngoroDB-2.7.0(win64)。我也试过v.2.6.9,但它是一样的。

我可以毫无问题地插入和更新

1 个答案:

答案 0 :(得分:1)

问题是序列化aql选项,现在修复了

抱歉造成的任何不便

下载新的nuget包 https://www.nuget.org/packages/ArangoDB.Client