Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for compatibility and support for RethinkDB 1.15 #173

Merged
merged 17 commits into from
Oct 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

### Features

* Upgrade to support RethinkDB version 1.15. [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173) & [Issue #171](https://github.com/mfenniak/rethinkdb-net/issues/171)

* New Group method can be used for grouping on an index value, or between 1 and 3 different key values.

* Count aggregate now supports a predicate for counting only matching rows.

* Max, Min, Avg, Sum, Count, and Contains aggregates are now fully supported. Previously only Avg and Sum aggregates were supported.

* Support for serializing and deserializing TimeSpan data types, which was added to the Newtonsoft serializer but not the basic serialization implementation. [PR #152](https://github.com/mfenniak/rethinkdb-net/issues/152)

* Expressions now support the addition of DateTime and TimeSpan objects, as well as DateTime and DateTimeOffset's Add methods (eg. AddHours, AddDays). [PR #152](https://github.com/mfenniak/rethinkdb-net/issues/152), [Issue #158](https://github.com/mfenniak/rethinkdb-net/issues/158) Note, AddMonths is not supported.
Expand All @@ -12,6 +20,18 @@

* Support for OrderBy on indexes. [Issue #162](https://github.com/mfenniak/rethinkdb-net/issues/162)

### Breaking Changes

* [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173) contained a number of breaking changes to maintain consistency with RethinkDB driver changes on other platforms and remove functionality that is no longer supported by RethinkDB.

* Remove base parameter from Reduce(); it's been removed in RethinkDB and instead an error occurs when attempting to reduce an empty sequence, and the only element is returned when reducing a single-element sequence. Part of [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173).

* UpdateAndReturnValues, InsertAndReturnValues, and DeleteAndReturnValues have all been renamed to "...ReturnChanges", and their return value has changed to support returning multiple changes. These changes are for compatibility and to maintain consistency with other RethinkDB drivers. Part of [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173).

* GroupedMapReduce has been removed for consistency with other RethinkDB drivers. .Group(...).Map(...).Reduce(...) can be used as an alternative. Part of [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173).

* GroupBy and its prebuilt aggregates have been removed for consistency with other RethinkDB drivers. .Group() followed by an aggregate can be used instead. Part of [PR #173](https://github.com/mfenniak/rethinkdb-net/issues/173).


## 0.7.0.0 (2013-11-02)

Expand Down
35 changes: 20 additions & 15 deletions rethinkdb-net-newtonsoft-test/Integration/ComplexObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,33 @@ private async Task DoReplace()
[Test]
public void ReplaceAndReturnValue()
{
var resp = connection.Run(testTable.Get(insertedObject.Id).ReplaceAndReturnValue(new ComplexObject() {Id = insertedObject.Id, Name = "Jack Black"}));
var resp = connection.Run(testTable.Get(insertedObject.Id).ReplaceAndReturnChanges(new ComplexObject() {Id = insertedObject.Id, Name = "Jack Black"}));
Assert.That(resp, Is.Not.Null);
Assert.That(resp.FirstError, Is.Null);
Assert.That(resp.Replaced, Is.EqualTo(1));
Assert.That(resp.GeneratedKeys, Is.Null);
Assert.That(resp.OldValue, Is.Not.Null);
Assert.That(resp.OldValue.Name, Is.EqualTo("Brian Chavez"));
Assert.That(resp.NewValue, Is.Not.Null);
Assert.That(resp.NewValue.Name, Is.EqualTo("Jack Black"));
Assert.That(resp.Changes, Is.Not.Null);
Assert.That(resp.Changes, Has.Length.EqualTo(1));
Assert.That(resp.Changes[0].OldValue, Is.Not.Null);
Assert.That(resp.Changes[0].OldValue.Name, Is.EqualTo("Brian Chavez"));
Assert.That(resp.Changes[0].NewValue, Is.Not.Null);
Assert.That(resp.Changes[0].NewValue.Name, Is.EqualTo("Jack Black"));
}

[Test]
public void UpdateAndReturnValue()
{
var resp = connection.Run(testTable.Get(insertedObject.Id).UpdateAndReturnValue(o => new ComplexObject() {Name = "Hello " + o.Id + "!"}));
var resp = connection.Run(testTable.Get(insertedObject.Id).UpdateAndReturnChanges(o => new ComplexObject() {Name = "Hello " + o.Id + "!"}));
Assert.That(resp, Is.Not.Null);
Assert.That(resp.FirstError, Is.Null);
Assert.That(resp.Replaced, Is.EqualTo(1));

Assert.That(resp.NewValue, Is.Not.Null);
Assert.That(resp.OldValue, Is.Not.Null);

Assert.That(resp.OldValue.Name, Is.EqualTo("Brian Chavez"));
Assert.That(resp.NewValue.Name, Is.EqualTo("Hello " + resp.OldValue.Id + "!"));
Assert.That(resp.Changes, Is.Not.Null);
Assert.That(resp.Changes, Has.Length.EqualTo(1));
Assert.That(resp.Changes[0].NewValue, Is.Not.Null);
Assert.That(resp.Changes[0].OldValue, Is.Not.Null);
Assert.That(resp.Changes[0].OldValue.Name, Is.EqualTo("Brian Chavez"));
Assert.That(resp.Changes[0].NewValue.Name, Is.EqualTo("Hello " + resp.Changes[0].OldValue.Id + "!"));
}

[Test]
Expand All @@ -149,14 +152,16 @@ private async Task DoDelete()
[Test]
public void DeleteAndReturnValues()
{
var resp = connection.Run(testTable.Get(insertedObject.Id).DeleteAndReturnValue());
var resp = connection.Run(testTable.Get(insertedObject.Id).DeleteAndReturnChanges());
Assert.That(resp, Is.Not.Null);
Assert.That(resp.FirstError, Is.Null);
Assert.That(resp.Deleted, Is.EqualTo(1));
Assert.That(resp.GeneratedKeys, Is.Null);
Assert.That(resp.OldValue, Is.Not.Null);
Assert.That(resp.OldValue.Id, Is.EqualTo(insertedObject.Id));
Assert.That(resp.NewValue, Is.Null);
Assert.That(resp.Changes, Is.Not.Null);
Assert.That(resp.Changes, Has.Length.EqualTo(1));
Assert.That(resp.Changes[0].OldValue, Is.Not.Null);
Assert.That(resp.Changes[0].OldValue.Id, Is.EqualTo(insertedObject.Id));
Assert.That(resp.Changes[0].NewValue, Is.Null);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class NewtonsoftDatumConverterFactory : AbstractDatumConverterFactory

public override bool TryGet<T>(IDatumConverterFactory rootDatumConverterFactory, out IDatumConverter<T> datumConverter)
{
// Use rethinkdb-net's support for $reql_type$=GROUPED_DATA return values.
if (GroupingDictionaryDatumConverterFactory.Instance.TryGet<T>(rootDatumConverterFactory, out datumConverter))
return true;

//I guess we could have some more specific checks here
//but if we get here last in the NewtonsoftSerializer order, then
//I suppose we can handle it if no preceding converters could handle it.
Expand Down
Loading