vapor-community / mongo-driver

MongoDB driver for Fluent
28 stars 26 forks source link

provide warning to those wishing to use siblings #14

Closed jjaybrown closed 7 years ago

jjaybrown commented 7 years ago

siblings within fluent, require unions to be implemented in mongo driver

tanner0101 commented 7 years ago

I think something like print("[WARNING] Unions are not currently supported by Mongo")

Using fatalError will crash the whole server.

Joannis commented 7 years ago

I personally feel that fatalError is severely underused. In a lot of cases I'd rather crash the server than start causing unexpected behaviour. Unexpected behaviour could have nasty side-effects, whereas fatalError clearly indicates the programmer error.

For example:

let array = [0, 1, 2, 3, 4, 5]
print(array[7]) // fatalError

This'll crash your application for the same reason, and rightfully so.

jjaybrown commented 7 years ago

I agree with @Joannis, any attempt to use a Union, should make clear it's not available, crashing the server over unexpected behaviour, or in my case hours of debugging to find it wasn't supported.