diff --git a/rethink-client.js b/rethink-client.js index d3e5570..85baef1 100644 --- a/rethink-client.js +++ b/rethink-client.js @@ -18,6 +18,10 @@ var readMethods = [ var tableDeps = {}; Rethink.Table = function (name, options) { + if (!(this instanceof Rethink.Table)) { + return new Rethink.Table(name, options); + } + options = options || {}; // Allow anonymous collections, but still give them some identifier diff --git a/rethink.js b/rethink.js index 35ee311..e45d93b 100644 --- a/rethink.js +++ b/rethink.js @@ -30,6 +30,10 @@ try { Rethink._connection = connection; Rethink.Table = function (name, options) { + if (!(this instanceof Rethink.Table)) { + return new Rethink.Table(name, options); + } + var self = this; options = options || {};