Skip to content

GOTCHA!

Brian Chavez edited this page Jun 4, 2016 · 14 revisions

GOTCHA!

You have entered the forest of goblins! A collection of gotchas goblins to lookout for when using the driver or they may cost you pain and headaches. Being aware of these gotchas will help you slay goblins should you encounter them in your journey to greatness. Take heed the warnings from your forefathers and foremothers for they have distilled onto you the knowledge so that you may succeed. Beware, ugly goblins ahead!


Avoid using DateTime.MinValue in your types

Bad things happen when DateTime.MinValue is used. For example, you might be tempted to use DateTime.MinValue:

DateTime.MinValue = 1/1/0001 12:00:00 AM

The minimum date time supported by RehtinkDB is:

1/1/1400

You will run into problems trying to store 0001 when the minimum is 1400. Use DateTime? nullable to indicate a time has not been set.

See Issue 49 and 66. Additionally, .NET Core DateTime.MinValue calculations are different between Windows and Linux platforms. See dotnet/corefx:Issue 9019.

The moral of story: Use DateTime? foo = null for MinValue.


$reql_type$ all up in my JObject

This won't work:

var items = Table("foo").RunAtomAsync<IEnumerable<JObject>>(conn);

This will:

var items = Table("foo").RunAtomAsync<JArray>(conn);

See Issue 65.


if (expr == null) and the spirit of NullReferenceException

If you are building dynamic queries using ReQL terms, you might do something like:

if( expr == null )

And you'll get a mysterious exception. However, this will work:

if( ReferenceEquals(expr, null) )

See Issue 55.