bchavez / rethinkdb.driver Goto Github PK
View Code? Open in Web Editor NEW:headphones: A NoSQL C#/.NET RethinkDB database driver with 100% ReQL API coverage.
Home Page: http://rethinkdb.com/api/java
License: Other
:headphones: A NoSQL C#/.NET RethinkDB database driver with 100% ReQL API coverage.
Home Page: http://rethinkdb.com/api/java
License: Other
Hello, me again =) v2.3.3-beta-1 build 533 works great with RC2 on Windows. But when i deploy it on Linux - new error shows up:
Sockets on this platform are invalid for use after a failed connection attempt, and as a result do not support attempts to connect to multiple endpoints.
connection code:
_conn = RDB.Connection().Hostname(_host).Port(_port).Connect();
I believe it caused by this commit - dotnet/corefx@30bd4b7
Hi guys, this is maybe a noob question considering i am initiating with c# and xamarin with xamarin forms, when i try to install the nuget package with Xamarin Studio in Mac OSX i get this error message:
"Could not install package 'RethinkDb.Driver 2.2.10'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."
Any tips?
Thanks
Created a new class object with a DateTime without settings its value. Assuming it chooses the default value.
When trying to insert this object into RethinkDB, this error occurs:
2016-01-27 00:13:49 [Verbose] JSON Send: Token: 11, JSON: [1,[56,[[15,[[14,["test"]],"userinvitation"]],{"Used":[99,["0001-01-01T00:00:00.0000000"]],"Created":[99,["0001-01-01T00:00:00.0000000"]],"CreatedByUserId":null,"UsedByUserId":null,"InvitedEmail":"[email protected]","TenantId":"c2673df4-329e-4c8b-9cd0-2ab229abd3a4","id":"c756c852-366c-4246-86ba-7c6c9aa27503","IsDeleted":false}]],{}]
2016-01-27 00:13:49 [Verbose] JSON Recv: Token: 11, JSON: {"t":18,"e":3000000,"r":["Error in time logic: Year is out of valid range: 1400..10000."],"b":[1,"Created",0]}
Is there any particular reason the standard java naming conventions were maintained in the port? Was this for consistency or sameness with the java driver?
In some places the driver seems to embrace some c# features, such as with async/await. However, in other places the driver still feels extremely Java-like, such as the use of getter and setter methods instead of properties.
Is documentation available on where the line in the sand is being drawn for what is being altered in the port and what is not?
Trying to fetch an object containing an array throws an exception with the messag System.Exception: fromJSONArray not implemented
. Further investigation shows that Profile.cs throws this error and that in fact is no implemented. I see that the "not yet ready but official" java driver as seen here has implemented this (or done something different).
Is this on the roadmap? I would try to implement this myself, but last time (some time ago now) I tried to build the project it failed. I could try again if your hands are full.
I'm on Windows 7 using VS2013 with 2.2.5-beta-2 RethinkDb.Driver.ReGrid
nuget package. I'm also using the Windows version of the server RethinkDB 2.2.4-windows-alpha-4
I can upload the file ok using this code
Bucket bucket = new Bucket(connection, dbname, "file");
bucket.Purge();
bucket.Mount();
var uploadId = bucket.Upload("MyNameIsBob.jpg", File.ReadAllBytes("1.jpg"));
log.Information("UploadId {uploadId}", uploadId);
Which logs out the file Id
2016-02-13 11:44:53 [Information] UploadId d9620ba1-fe64-45bb-8cba-d2faa9d77f12
But when I try and download I get this error:
byte[] bytes = bucket.DownloadBytes(uploadId, new DownloadOptions());
log.Information("MyNameIsBob length {length}", bytes.Length);
This is the exception stack trace:
System.AggregateException: One or more errors occurred. ---> RethinkDb.Driver.ReGrid.ChunkException: ReGrid chunk 2 of file id d9620ba1-fe64-45bb-8cba-d2faa9d77f12 is missing.
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.GetNextBatchFromCursor(Boolean hasMore)
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetNextBatchAsync>d__19.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetSegmentAsync>d__17.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<ReadAsync>d__16.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadToStreamHelperAsync>d__36.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__34.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__33.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadAsBytesAsync>d__26.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at RethinkDb.Driver.Utils.TaskHelper.WaitSync[T](Task`1 task)
at RethinkDb.Driver.ReGrid.Bucket.DownloadBytes(Guid fileId, DownloadOptions options)
at Sprightly.ConsoleSpike.Program.<>c__DisplayClass5.<<Main>b__4>d__7.MoveNext() in c:\Dev\Sprightly\src\Sprightly.ConsoleSpike\Program.cs:line 71
---> (Inner Exception #0) RethinkDb.Driver.ReGrid.ChunkException: ReGrid chunk 2 of file id d9620ba1-fe64-45bb-8cba-d2faa9d77f12 is missing.
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.GetNextBatchFromCursor(Boolean hasMore)
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetNextBatchAsync>d__19.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetSegmentAsync>d__17.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<ReadAsync>d__16.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadToStreamHelperAsync>d__36.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__34.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__33.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at RethinkDb.Driver.ReGrid.Bucket.<DownloadAsBytesAsync>d__26.MoveNext()<---
Compose.io only supports SSL based connections. From what i see in the your source code, it would be pretty easy to conditionally slip in SSLStream vs NetworkStream in SocketWrapper class.
Is this in your near future plans?
Thanks
I have the following code:
Cursor<User> result = _table.run<User>(_c.Connection);
return result.BufferedItems;
I only have one document in my database looking like this (raw fetched with web ui):
[{"Address":null,"Birthday":{"$reql_type$":"TIME","epoch_time":650937600,"timezone":"+02:00"},"DisplayName":"fiLLLip","Email":"[email protected]","FirstName":"Filip","LastName":"Tomren","MiddleName":"Andre Larsen","Phone":"+47123455678","Picture":null,"TenantPermissions":null,"id":"aa93ca25-8672-4545-a927-90b9b1249f4c"}]
When I run the code supplied I get the following exception:
$exception {"Error reading date. Unexpected token: StartObject. Path 'Birthday', line 1, position 40."} {$4} Newtonsoft.Json.JsonReaderException
With the following stack trace:
Newtonsoft.Json.JsonReader.ReadAsDateTimeInternal()
Newtonsoft.Json.Linq.JTokenReader.ReadAsDateTime()
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
Newtonsoft.Json.Linq.JToken.ToObject[T]()
RethinkDb.Driver.Net.Cursor`1.<>c.<get_BufferedItems>b__17_0(JToken t)
System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
RethinkDb.Driver.Net.Cursor`1.get_BufferedItems()
TestSoftware.DataAccess.Database.RethinkDb.UserService.GetAll() UserService.cs: line: 54
TestSoftware.Api.Controllers.UsersController.Get() UsersController.cs: line: 26
My User
object looks like this (BaseModel contains an id field):
public class User : BaseModel
{
public IList<TenantPermission> TenantPermissions { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Picture { get; set; }
public DateTime Birthday { get; set; }
public string DisplayName { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public Address Address { get; set; }
}
My user object was added with the RethinkDb.Driver
, and posted with the following through an ASP.NET MVC controller:
{
"Email": "[email protected]",
"Phone": "+4712345678",
"DisplayName": "fiLLLip",
"FirstName": "Filip",
"MiddleName": "Andre Larsen",
"LastName": "Tomren",
"Birthday": "1990-08-18T00:00:00-00:00"
}
Thanks for all the work on this library. I like it so far.
Do you have any plans to provide more idiomatic API with strong typing? As it stands everything takes in an object.
Another example is optArgs which is string based. Why not have a class with all the supported properties e.g. InstertArgs that you can pass into .Insert() call?
Hello,
I'm not sure you could call this an issue on your side but I wanted to state it so if it's something to keep note of, we could add it to the wiki.
If you create class and set a property as a JsonIgnore property, it does not get set when you select from the DB.
Class:
public class User
{
[JsonIgnore]
public Guid id { get; set; }
public string name { get; set; }
}
Select:
var all = _r.Db("myDB")
.Table("Users")
.Run<User>(conn);
Result:
[0] User()
id = {00000000-0000-0000-0000-000000000000}
name = "John"
Thanks ๐
Hi I've just cloned down the project, and when I try run build.cmd I get the following error
Checking Paket version (downloading latest stable)...
Paket.exe 2.50.6 is up to date.
Paket version 2.50.6.0
Skipping resolver for group build since it is already up-to-date
Skipping resolver for group Main since it is already up-to-date
C:\Dev\RethinkDb.Driver\Builder\paket.lock is already up-to-date
0 seconds - ready.
WORKING DIR: C:\Dev\RethinkDb.Driver
Building project with version: LocalBuild
Shortened DependencyGraph for Target zip:
<== zip
<== dnx
<== BuildInfo
<== astgen
<== restore
<== Clean
<== msb
<== mono
The resulting target order is:
- Clean
- restore
- astgen
- BuildInfo
- dnx
- msb
- mono
- zip
Starting Target: Clean
C:\Dev\RethinkDb.Driver\__test\results.xml does not exist.
Deleting contents of C:\Dev\RethinkDb.Driver\__compile
Deleting contents of C:\Dev\RethinkDb.Driver\__package
Finished Target: Clean
Starting Target: restore (==> Clean)
MS NuGet Project Restore
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Task failed with Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
Retry.
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Task failed with Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
Retry.
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Task failed with Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
Retry.
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Task failed with Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
Retry.
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Task failed with Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
Retry.
C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe "restore" "C:\Dev\RethinkDb.Driver\Source\RethinkDb.Driver.sln" "-OutputDirectory" "C:\Dev\RethinkDb.Driver\Source\packages"
Running build failed.
Error:
System.Exception: Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
at [email protected](String message) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76
at Fake.ProcessHelper.ExecProcessWithLambdas(FSharpFunc`2 configProcessStartInfoF, TimeSpan timeOut, Boolean silent, FSharpFunc`2 errorF, FSharpFunc`2 messageF) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76
at Fake.RestorePackageHelper.runNuGet(String toolPath, TimeSpan timeOut, String args, FSharpFunc`2 failWith) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 86
at [email protected](Unit unitVar0) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 94
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.RestorePackageHelper.runNuGetTrial(Int32 retries, String toolPath, TimeSpan timeOut, String args, FSharpFunc`2 failWith) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 95
at Fake.RestorePackageHelper.RestoreMSSolutionPackages(FSharpFunc`2 setParams, String solutionFile) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 189
at [email protected](Unit _arg5) in C:\Dev\RethinkDb.Driver\Builder\build.fsx:line 120
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 484
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Clean 00:00:00.0032554
Total: 00:00:00.0928552
Status: Failure
---------------------------------------------------------------------
1) System.Exception: Start of process C:\Dev\RethinkDb.Driver\Builder\tools\NuGet\NuGet.exe failed. The system cannot find the file specified
at [email protected](String message) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76
at Fake.ProcessHelper.ExecProcessWithLambdas(FSharpFunc`2 configProcessStartInfoF, TimeSpan timeOut, Boolean silent, FSharpFunc`2 errorF, FSharpFunc`2 messageF) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 76
at Fake.RestorePackageHelper.runNuGet(String toolPath, TimeSpan timeOut, String args, FSharpFunc`2 failWith) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 86
at [email protected](Unit unitVar0) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 94
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.TaskRunnerHelper.runWithRetries[a](FSharpFunc`2 f, Int32 retries) in C:\code\fake\src\app\FakeLib\TaskRunnerHelper.fs:line 32
at Fake.RestorePackageHelper.runNuGetTrial(Int32 retries, String toolPath, TimeSpan timeOut, String args, FSharpFunc`2 failWith) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 95
at Fake.RestorePackageHelper.RestoreMSSolutionPackages(FSharpFunc`2 setParams, String solutionFile) in C:\code\fake\src\app\FakeLib\RestorePackageHelper.fs:line 189
at [email protected](Unit _arg5) in C:\Dev\RethinkDb.Driver\Builder\build.fsx:line 120
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 484
---------------------------------------------------------------------
C:\Dev\RethinkDb.Driver>
Just dawned on me using the driver while writing a server-side application. The ReadResponse
isn't thread-safe. We possibly need a dedicated thread ReadLoop
for reading responses from the network-stream, then dispatch / signal / handing off the response to await
ing threads identified by their query token.
We try to use this new monikers - aspnet/Announcements#98, but RethinkDb.Driver targets only old versions - net45, dnxcore50 and dnx451. Can you add dotnet5.4?
Any plans to implement row?
Row feels like a good way to construct queries on the fly (trees of RqlExpr). I had to resort to working ReqlFunction1 which works but is a bit clunky.
do_ method in java only has underscore because it conflicts with the keyword, right? With the capitalization C# does not have this probelm
This is small feature request/recommendation.
Sometimes I like working with raw JSON objects. It would be great if the driver enabled inserting raw JObjects into tables. Right now, the following code throws an error.
JObject state = .... ;
_r.db(DATABASE_NAME).table(EVENTS_TABLE_NAME)
.insert(state).run(_conn);
Would love to see some documentation, maybe some samples on how to use the different endpoints.
I'm trying to use it like the official documentation states, but I get a lot of errors, and the way I manage to use some of it feels more like a hack than the right way to do it.
To get insert to work I had to do the following where obj
is a custom class with properties:
var json = JsonConvert.SerializeObject(obj);
var keyValue = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
_r.db(dbName).table(tableName).insert(keyValue).run(_connection);
Putting the object directly resultet in an exception, same with the serialized string.
I have not yet managed to get getAll
to function. If someone could lead me in the right direction, I could possibly write some documentation along the way while using it.
Would it make sense to to swap out Json.NET for Jil or provide alternative json implementation?
What is the preferred way to check if a table exists in a database?
Using .tableList() ?
Thanks
Hello.
I'm having an issue where I try to serialize/deserialize POCOs with a byte[] properties that has null value. Serialization and insertion work fine, but not the get/deserialization part.
As promised here's a test that fails JObject roundtrip failing test. Just drop it into the GitHubIssues.cs
[Test]
public void issue_39()
{
var dateTime = DateTime.Parse("2016-09-03T10:30:20Z");
var obj = new JObject(new JProperty("timestamp", dateTime));
var table = R.Db(DbName).Table(TableName);
table.Delete().Run(conn);
var result = table.Insert(obj).RunResult(conn);
var id = result.GeneratedKeys[0];
var check = table.Get(id).RunAtom<JObject>(conn);
check.Dump();
var dt = (DateTime)check["timestamp"];
dt.Should().Be(dateTime);
}
There's the output of check.Dump()
:
{
"id": "e605a378-d8f9-4d0d-b910-e4707c0ce6b0",
"timestamp": {
"$reql_type$": "TIME",
"epoch_time": 1472898620,
"timezone": "+10:00"
}
}
Thinking about connection pooling on a cluster with multiple connections.
Good starting point would be: (thanks AtnNn)
https://github.com/dancannon/gorethink/blob/master/cluster.go
This issue will serve as the design notes / change log implementation details.
A change feed on r.db("rethinkdb").table("server_status")
seems like a great place to get updates about the cluster and IP info for multiple connections.
The next question would be how would we expose the API on r.
to for a connection pool?
Current Connection API: Single Connection:
var c = r.connection()
.hostname("192.168.0.11")
.port(28015)
.timeout(60)
.connect();
Proposed API for connection pooling:
//Example 1
var p = r.connectionPool()
.seed("192.168.0.11", "192.168,0.12", )
.port(28015)
.connect();
//Example 2
var p = r.connection()
.pool()
.seed("192.168.0.11", "192.168,0.12")
.port(28015)
.connect();
//Example 3
var p = r.cluster()
.seed("192.168.0.11", "192.168,0.12", )
.port(28015)
.connect();
Any thoughts @deontologician on how the Java API would expose a pooled connection configuration?
I can see that some of the base methods used by the driver have support for cancellation tokens, but these are not exposed at the public level for methods like RunAsync<T>
. It would be nice if every Async method could be cancelled, especially the long running ones like MoveNextAsync()
.
I tried to insert the following object
And here is the serialized version of the object I'm trying to insert, serialized with JsonConvert.SerializedObject()
The error I get is RethinkDb.Driver.ReqlClientError
"Client is buggy (failed to deserialize query)."
with stacktrace
RethinkDb.Driver.Net.Connection.RunQuery[T](Query query)
RethinkDb.Driver.Net.Connection.run[T](ReqlAst term, Object globalOpts)
RethinkDb.Driver.Ast.ReqlAst.run[T](Connection conn, Object globalOpts)
RethinkDb.Driver.Ast.ReqlAst.run(Connection conn, Object globalOpts)
TestProject.DataAccess.Database.RethinkDb.UserService.Create(User obj) UserService.cs: line: 29
TestProject.Api.Controllers.DemoController.Get() DemoController.cs: line: 63
Is this a message from the server? Are we sending invalid data? What could be the issue here?
Hello. We are now moving to rc2 and face problem with RethinkDb.Driver. This code
_conn = RDB.Connection().Hostname(_host).Port(_port).Connect();
throws exception:
Attempt by method 'RethinkDb.Driver.Net.SocketWrapper+<ConnectAsync>d__10.MoveNext()' to access method 'System.Net.Sockets.TcpClient.get_Client()' failed
As i understand, this commit is caused it:
Client property was removed from TCPClient. You are using it here - https://github.com/bchavez/RethinkDb.Driver/blob/master/Source/RethinkDb.Driver/Net/SocketWrapper.cs#L46
When opening a connection to our db server in an Api App hosted on an App Service on Azure I get the above error. After running directly from source it seems that when opening a socket without AddressFamily.InterNetwork
made it default to IPv6. Changing this line in SocketWrapper.cs
this.socket = new Socket(SocketType.Stream, ProtocolType.Tcp );
to this
this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
and it is wokring as it should.
You've got an override for ==
operator here:
public static ReqlExpr operator ==(ReqlExpr a, ReqlExpr b)
{
return (ReqlExpr) a.eq((object) b);
}
This throws when I do a comparison like this:
if (expr == null) ...
Got me very confused for a second. Can null be special cased here?
Add translation of queries like on indexes to use Between
.Where( x.Size > 5 && x.Size < 10 )
.Where( x.Date < DateTime.Now && x.Date > new DateTime( 2016, 1, 1 ) )
While waiting for the cursor troubles to get implemented, I used a workaround to get results with getAll at all:
var result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(id1, id2, id3).run(_connection);
List<Foo> all = new List<Foo>();
try
{
while (result.MoveNext())
{
all.Add(((JObject)result.Current).ToObject<Foo>());
}
}
catch (InvalidOperationException)
{
// Swallow the error
}
return all;
This returns three objects in a list. If I want to query a secondary index I have tried to change the var result
to the following with no results:
var result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(value, $"{{index={nameof(Foo.Value)}}}").run(_connection);
And if I try to change it to the following:
var result = (IEnumerator<object>)_rethinkDb.db(dbName).table(tableName).getAll(value, new {index=nameof(Foo.Value)}).run(_connection);
I get an error:
ReqlQueryLogicError: Primary keys must be either a number, string, bool, pseudotype or array (got type OBJECT):
{
"index": "Url"
}
How do I query this in the right way?
There is absolutely no documentation on the usage of orderBy function in c#. As a user I am having problem figuring out how I should pass the index to the function!
In JS:
r.table('sometable').orderby('someindex')
In c#:
r.Table('sometable').OrderBy(?????)
I would be very grateful if you could provide some information on this.
Thanks in advance
Add extension method ToCursor
and ToCursorAsync
to queryable
Related to #40. On Gitter:
Mehmet Afsin Yuce @mehmetafsinyuce
Hello, I am developing an UWP application and nuget package installation response was
All packages are compatible with UAP,Version=v10.0 (win10-arm)
but I am getting error
{"Could not load file or assembly 'System.Runtime, Version=4.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"System.Runtime, Version=4.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
Fw is Windows10 (10.0,B 10240)
is this library compatible with iot ? or I missed sth ? Please help....
In my new projects using vNext/AspNet5/DNX or whatever they are calling it today, I do not have the App.config or Web.config as described in the wiki.
How do I activate logging here? Could it be possible to enable this in-code?
Don't know if this is a bug or if it is supposed to be like this, but using update() with the trailing runResults() does not yield any results.
var result = _table.get(id).update(new { Target = value }).runResult(connection);
result.Changes.Count > 0; // result is null
var result = _table.get(id).update(new { Target = value }).optArg("return_changes", true).connection);
result.Changes.Count > 0; // returns true or false
Question...
With the Connection object, what is the recommended lifetime usage. For instance, in a web application should there be a Connection per request (which is kinda what happens with Entity Framework), or should the connection be reused for the lifetime of the process?
while (true) {
Console.Write("START");
var _r = RethinkDB.r;
var conn = _r.connection()
.hostname("IP")
.port(RethinkDBConstants.DEFAULT_PORT)
.timeout(60)
.connect();
var x = _r.db("DB")
.table("TABLE")
.count();
long resCount = x.run(conn);
Console.Write(" - C: " + resCount);
conn.close();
conn = null;
_r = null;
Console.WriteLine("FINISH");
Console.WriteLine();
Console.WriteLine();
}
So with that code I keep getting
"An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll
Additional information: One or more errors occurred."
Inner:
Object reference not set to an instance of an object.
" at RethinkDb.Driver.Net.SocketWrapper.SendQuery(Int64 token, String json, Boolean awaitResponse)
at RethinkDb.Driver.Net.Connection.SendQuery(Query query, Boolean awaitResponse)
at RethinkDb.Driver.Net.Connection.<RunQueryAsync>d__30`1.MoveNext()"
Any ideas why?
Thanks
I just saw the example at: http://rethinkdb.com/blog/rethinkdb-windows-preview/.
I was a bit surprised the example did not use the Async api provided by the library.
Unless there are good reasons examples should use the async api (examples should be exemplary).
Taking this further, the non-async API could be removed completely.
Allow the use of changes method on queryable
I'm trying to update a object containing an array of a custom object of mine. If I set the array to null
I manage to update the other values of the root object.
The document already in the database looks like this:
{
"Name": "testFile",
"Description": "Demo asdfasfadsfafile",
"Versions": null,
"Permissions": [
{
"Read": true,
"Write": true,
"Owner": true,
"UserId": "5cd708c8-c8b3-4108-8470-547dbd03ef70"
}
],
"TenantId": "default",
"id": "269571e7-f4c2-4318-b639-bbfd343fa0c7"
}
I'm trying to insert an updated document that should look something like this:
{
"Name": "testFile",
"Description": "Demo asdfasfadsfafile",
"Versions": : [
{
"Version": 1,
"Value": "value"
}
],
"Permissions": [
{
"Read": true,
"Write": true,
"Owner": true,
"UserId": "5cd708c8-c8b3-4108-8470-547dbd03ef70"
}
],
"TenantId": "default",
"id": "269571e7-f4c2-4318-b639-bbfd343fa0c7"
}
The query executes without errors (at least to my knowledge), but does not update the document. I've tried to feed the object through my own reflection method that removes properties set to null
and also feed the raw object into the .update(obj)
method, but to no luck. I haven't gotten the logging up and running due to #12 yet, so I haven't gotten around to debug it. Using the latest 0.0.7-alpha2.
Got this error when trying to install the nuget package
'Newtonsoft.Json 8.0.2' is not compatible with 'RethinkDb.Driver 2.2.0 constraint: Newtonsoft.Json (โฅ 7.0.0 && < 8.0.0)'
I should be able to downgrade my version of JsonNET since I'm just working on a demo, but any idea when 5834bc8 will get pushed to nuget?
This issue relates to rethinkdb/rethinkdb#5755, but I'm filing it here as well since I believe my use case would work if the driver serialized the DateTime the same way in both the insert and the update.
I'd prefer both the insert and the update to fail (by using ISO8601 serialization both places) or that both work (by using epochTime serialization both places).
Here's a simple test that illustrates my problem:
using System;
using Newtonsoft.Json;
using NUnit.Framework;
using RethinkDb.Driver;
using Should;
namespace DRIV.Common.Data.Helpers
{
public class Test
{
[JsonProperty("id")]
public int Id = 1;
public DateTime DateTime { get; set; }
private static RethinkDB R = RethinkDB.R;
[SetUp]
public void SetUp()
{
using (var connection = R.Connection().Connect())
{
R.Db("test").TableCreate("test").Run(connection);
}
}
[TearDown]
public void TearDown()
{
using (var connection = R.Connection().Connect())
{
R.Db("test").TableDrop("test").Run(connection);
}
}
[Test]
public void TestUpdateWithMinValue()
{
using (var connection = R.Connection().Connect())
{
var insertResult = R
.Db("test")
.Table("test")
.Insert(new Test { DateTime = DateTime.MinValue.ToUniversalTime() })
.RunResult(connection);
insertResult.Errors.ShouldEqual<ulong>(0);
var updateResult = R
.Db("test")
.Table("test")
.Get(Id)
.Update(orig =>
{
var unchanged = orig["DateTime"].Eq(DateTime.MinValue.ToUniversalTime());
return R.Error(unchanged.CoerceTo("string"));
})
.OptArg("return_changes", true)
.RunResult(connection);
updateResult.Errors.ShouldEqual<ulong>(1);
updateResult.FirstError.ShouldEqual("true");
}
}
}
}
And here's the TRACE log from running thetest:
Should.Core.Exceptions.EqualException : Assert.Equal() Failure
Position: First difference is at position 0
Expected: true
Actual: Error in time logic: Year is out of valid range: 1400..10000.
at DRIV.Common.Data.Helpers.Test.TestUpdateWithMinValue() in C:\Users\alfler\Projects\driv-data\03Common\DRIV.Common.Data\Helpers\Test.cs:line 59
[TRACE] JSON Send: Token: 1, JSON: [1,[60,[[14,["test"]],"test"]],{}]
[TRACE] JSON Recv: Token: 1, JSON: {"t":1,"r":[{"config_changes":[{"new_val":{"db":"test","durability":"hard","id":"c58274be-c560-4127-8f3e-13e32a598476","indexes":[],"name":"test","primary_key":"id","shards":[{"nonvoting_replicas":[],"primary_replica":"W7L_R90H7009_6gj","replicas":["W7L_R90H7009_6gj"]}],"write_acks":"majority"},"old_val":null}],"tables_created":1}]}
[TRACE] Response Pump: EndOfStreamException - Unable to read beyond the end of the stream. The connection can no longer be used. ResponsePump is preparing to shutdown.
[TRACE] Cleaning up Response Pump awaiters for localhost:28015
[TRACE] JSON Send: Token: 1, JSON: [1,[56,[[15,[[14,["test"]],"test"]],{"id":1,"DateTime":{"$reql_type$":"TIME","epoch_time":-62135596800.0,"timezone":"+00:00"}}]],{}]
[TRACE] JSON Recv: Token: 1, JSON: {"t":1,"r":[{"deleted":0,"errors":0,"inserted":1,"replaced":0,"skipped":0,"unchanged":0}]}
[TRACE] JSON Send: Token: 2, JSON: [1,[53,[[16,[[15,[[14,["test"]],"test"]],1]],[69,[[2,[1]],[12,[[51,[[17,[[170,[[10,[1]],"DateTime"]],[99,["0001-01-01T00:00:00.0000000Z"]]]],"string"]]]]]]],{"return_changes":true}],{}]
[TRACE] JSON Recv: Token: 2, JSON: {"t":1,"r":[{"changes":[],"deleted":0,"errors":1,"first_error":"Error in time logic: Year is out of valid range: 1400..10000.","inserted":0,"replaced":0,"skipped":0,"unchanged":0}]}
[TRACE] Response Pump: EndOfStreamException - Unable to read beyond the end of the stream. The connection can no longer be used. ResponsePump is preparing to shutdown.
[TRACE] Cleaning up Response Pump awaiters for localhost:28015
[TRACE] JSON Send: Token: 1, JSON: [1,[61,[[14,["test"]],"test"]],{}]
[TRACE] JSON Recv: Token: 1, JSON: {"t":1,"r":[{"config_changes":[{"new_val":null,"old_val":{"db":"test","durability":"hard","id":"c58274be-c560-4127-8f3e-13e32a598476","indexes":[],"name":"test","primary_key":"id","shards":[{"nonvoting_replicas":[],"primary_replica":"W7L_R90H7009_6gj","replicas":["W7L_R90H7009_6gj"]}],"write_acks":"majority"}}],"tables_dropped":1}]}
I'm using the 2.2.10 version of the driver against RethinkDB 2.3.1 on Windows.
The API has changed for ILogger in RC2 causing an error when logging
At the moment, the signature for Or()
on a ReqlExpr
is:
Or(object exprA, params object[] exprs)
And for And()
:
And(params object[] exprs)
Not only would it be more consistent to have Or()
behave like And()
, it would also make it easier to build these kinds of expressions dynamically from a collection of items.
Could be good if the Linq Provider will suggest indexes to improve query performance
One one the first things that confused me was why are there so many Run* methods.
Let's see (excluding async versions):
object Run()
object Run<T>()
void RunNoReply()
Cursor<T> RunCursor<T>()
T RunAtom<T>()
T RunResult<T>()
Result RunResult()
Cursor<Change<T>> RunChanges<T>()
IEnumerable<GroupedResult<TKey, TItem>> RunGrouping<TKey, TItem>()
Why is (2) needed? If i give it a and it returns object it's not at useful as it could be. Here's suggestion:
object Run()
T Run<T>()
Cursor<T> RunCursor<T>()
If you need Result you'd just do Run<Result>()
, if you need Atom you'd do Run<int>
.
What do you think?
In Josh's talk about the Java driver, there's a mention that Java doesn't support operator overloading. https://www.youtube.com/watch?v=emjzNpKoNkM#t=16m53s
C# can support method overloading, seems like there's a lot we can do here with C#'s method overloads.
Some inspection on the Python driver:
class RqlQuery(object):
....
# The following are all operators and methods that operate on
# Rql queries to build up more complex operations
# Comparison operators
def __eq__(self, other):
return Eq(self, other)
def __ne__(self, other):
return Ne(self, other)
def __lt__(self, other):
return Lt(self, other)
def __le__(self, other):
return Le(self, other)
def __gt__(self, other):
return Gt(self, other)
def __ge__(self, other):
return Ge(self, other)
# Numeric operators
....
Looks like a whole new area we can improve on... we should be able to pull off a lot of operator overloads for C#. This is pretty cool.
In particular, with getField
, the query in Josh's talk:
python: some_object["field"]["subfield"]
JavaScript: someObject("field")("subfield")
java: someObject.getField("field").getField("subfield")
and in C# it may be possible do this type of query:
C#: r.db("mydb").table("users").get("id")["field"]["subfield"]
Looks legit.
My questions would be:
_1. What is the mapping between Python's class RqlQuery
and Java's AST? ReqlExpr
or ReqlAst
?
ReqlExpr
or ReqlAst
. My gut feeling here, operator overloads would go into ReqlExpr
. Terms like Db
inherit from ReqlAst
, and doesn't make sense for operator overloads to live in ReqlAst
super class because operator overloads would be available on the Db
term. ReqlExpr
seems like the best place._2. In particular with .getField
, is there a strict subset of terms that can have .getField()
called on? With .optArg
there was a distinction between terms with and without .optArg()
calls. I'm just wondering if the same could be true with .getField()
if Java supported operator overloading.
Thanks for your insight ๐
cool idea, and i think it would work well, just need to figure out if reflecting over the properties is the best way to do this. or, possibly keep the object as is until serialization.
Here's one example:
https://rethinkdb.com/api/java/db_create/
says it will throw ReqlRuntimeError if the database exists.
I get AggregateException
with inner ReqlDriverError
which says:
The query response cannot be converted to an object of T or List<T>. This run helper works with SUCCESS_ATOM results. The server response was RUNTIME_ERROR. If the server response can be handled by this run method try converting to T or List<T>. Otherwise, if the server response cannot be handled by this run helper use another run helper like `.runCursor` or `.runResult<T>`.
The exceptions thrown are part of the API, I suggest they line up with the Java driver.
As a side note there seems to be a bit of schism in the driver w.r.t. error handling most of the regular operations like Insert or Update return errors in the Result whereas DbCreate or TableCreate just throw. Is there any rationale behind this divide?
Edit:
I've hooked up the TRACE from driver. This is a different exception:
JSON Recv: Token: 1, JSON: {"t":18,"e":3000000,"r":["Database name `test-db` invalid (Use A-Za-z0-9_ only)."],"b":[0]}
So it obviously doesn't like hyphens in database names. Can this error message be exposed in ReqlDriverError? Without trace there's now way to tell what went wrong.
Edit 2:
My original statement stands. When database exists I get AggregateException->ReqlDriverError and the TRACE says this:
JSON Recv: Token: 1, JSON: {"t":18,"e":4100000,"r":["Database `diabetes_australia` already exists."],"b":[]}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.