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

r.now() usage? #3

Closed
xenolf opened this issue Feb 16, 2014 · 3 comments
Closed

r.now() usage? #3

xenolf opened this issue Feb 16, 2014 · 3 comments

Comments

@xenolf
Copy link

xenolf commented Feb 16, 2014

How does one use r.now() with rethinkdbdash?
I tried like this (according to RQL official docs):

var file = {
        originalName: form.fields.name,
        path: 'xyz',
        creationDate: r.now()
    };
yield r.table('table').insert(file).run();

and like this (got this from the tests):

var file = {
        originalName: form.fields.name,
        path: 'xyz',
        creationDate: yield r.now().run()
    };
yield r.table('table').insert(file).run();

Using the first version the creationDate property is a function, in the second version it is a date.
However, no matter which version I use I'm always getting the following error:

ReqlDriverError
    at Term.expr (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:780:41)
    at new Json (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:2363:30)
    at Term.json (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:840:12)
    at Term._exprJSON (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:922:66)
    at Term.exprJSON (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:846:23)
    at new Insert (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:2377:32)
    at Term.insert (/home/usr/project/node_modules/rethinkdbdash/lib/term.js:214:12)
    at save (/home/usr/project/file.js:25:28)

Am I just not using r.now() right or is there something else not working right?

@neumino
Copy link
Owner

neumino commented Feb 16, 2014

I just run a quick test, and that's a bug (I would suspect exprJSON to be the culprit).

I'll look into that now.

@neumino
Copy link
Owner

neumino commented Feb 16, 2014

@xenolf thanks for the bug report.
The bug was indeed in r.exprJSON that we use to serialize the argument of insert to JSON.

The fix has been released in 1.11.8

@xenolf
Copy link
Author

xenolf commented Feb 16, 2014

Thanks for fixing this issue that fast!

thelinuxlich added a commit to AIDAX/rethinkdbdash that referenced this issue May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants