neumino / rethinkdbdash

An advanced Node.js driver for RethinkDB with a connection pool, support for streams etc.
MIT License
848 stars 109 forks source link

r.row() doesn't accept arguments #339

Closed torsina closed 6 years ago

torsina commented 7 years ago

I wanted to get a time range in my table r.table('analytic').filter(r.row("date").le(b).and(r.row("date").ge(a))).run();

and it thrown

{ ReqlDriverError at Function.Term._arity (C:\Users\theo\WebstormProjects\Arys\node_modules\rethinkdbdash\lib\term.js:3016:11) at Function.Term.row (C:\Users\theo\WebstormProjects\Arys\node_modules\rethinkdbdash\lib\term.js:1320:10) at Object.db.countAnalyticByDate (C:\Users\theo\WebstormProjects\Arys\util\rethinkdb.js:147:50) at Object.func (C:\Users\theo\WebstormProjects\Arys\modules\analytic.js:35:20) at Client.on.message (C:\Users\theo\WebstormProjects\Arys\Arys.js:101:42) at emitOne (events.js:96:13) at Client.emit (events.js:191:7) at MessageCreateHandler.handle (C:\Users\theo\WebstormProjects\Arys\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34) at WebSocketPacketManager.handle (C:\Users\theo\WebstormProjects\Arys\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:120:65) at WebSocketManager.eventMessage (C:\Users\theo\WebstormProjects\Arys\node_modules\discord.js\src\client\websocket\WebSocketManager.js:273:31) at WebSocket.onMessage (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\WebSocket.js:442:14) at emitTwo (events.js:106:13) at WebSocket.emit (events.js:194:7) at Receiver.ontext (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\WebSocket.js:841:10) at C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:536:18 at Receiver.applyExtensions (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:371:5) at C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:508:14 at Receiver.flush (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:347:3) at Receiver.finish (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:541:12) at Receiver.expectHandler (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:499:31) at Receiver.add (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\Receiver.js:103:24) at TLSSocket.realHandler (C:\Users\theo\WebstormProjects\Arys\node_modules\ws\lib\WebSocket.js:825:20) msg: 'r.row takes 0 argument, 1 provided', message: 'r.row takes 0 argument, 1 provided.' }

this at me, even if it's the same as the example from the official driver(couldn't find a proper doc for rethinkdbdash)

possible bug, or me completly failing ?

rethinkdb server : 2.3.5 rethinkdbdash version : 2.3.29

neumino commented 7 years ago

Hum, it should work - are you sure the query you linked is the right one?

There are multiple tests for r.row taking arguments

https://github.com/neumino/rethinkdbdash/blob/master/test/document-manipulation.js#L179

torsina commented 7 years ago

just checked it, it's the right one

this is what a full entry look like

{ channel: '244146816797376512', date: 1497734318989, user: '306418399242747906' guild: '242655328410402816', id: '001513d4-c2d8-492d-ba8a-f8b38876db1e', item: '<:feelsluckyman:247432630541221888>' }

codermapuche commented 7 years ago

hello, is there any reason why r.row is a function but not have a function prototype methods? i want to run this: r.row.apply(null, "name") but r.row.apply is undefined

i are working in a client side wrapper of rethinkdbdash and need can call it dinamically, current i doing

Function.prototype.apply.call(r.row, r.row, ['name']);

i feeling dirty

neumino commented 7 years ago

Hum, that's because r.row is an object. Typically this is a valid query: r.table('foo').filter(r.row)