3
私はrethinkDBに新しく、フィルター機能を使用してユーザー名でデータを検索しようとしています。 しかし、rethinkDBはデータが存在してもnullイベントを返します。Rethinkdbクエリは常にnullを返します。
を更新しました
//Define Your Api//Define Your Api
import express from 'express';
import r from 'rethinkdb';
const router = express.Router();
router.post('/users',(req,res)=>{
let username = req.body.data.username;
let password = req.body.data.password;
console.log(username,password);
r.connect({db:"image"}).then((conn) => {
r.table("users").filter({username:"arfo"}).run(conn,function (err, data) {
console.log(data) //null
})
})
});
export default router
それは私にこのようなデータの束を返す私は、このデータを操作するために
Cursor {
_type: 3,
_eachCb: [Function],
_conn:
TcpConnection {
host: 'localhost',
port: 28015,
db: 'image',
authKey: '',
timeout: 20,
ssl: false,
outstandingCallbacks: {},
nextToken: 2,
open: true,
closing: false,
buffer: <Buffer >,
_events: {},
_eventsCount: NaN,
_closePromise: null,
rawSocket:
Socket {
connecting: false,
_hadError: false,
_handle: [Object],
_parent: null,
_host: 'localhost',
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 7,
_maxListeners: undefined,
_writableState: [Object],
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 325,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
user: 'admin',
password: '',
read: [Function],
_consuming: true } },
_token: 1,
_opts: {},
_root: { [Function] args: [ [Object], [Object] ], optargs: {} },
_responses: [ { t: 2, r: [Object], n: [] } ],
_responseIndex: 0,
_outstandingRequests: 0,
_iterations: 0,
_endFlag: true,
_contFlag: false,
_closeAsap: false,
_cont: null,
_cbQueue: [],
_closeCb: null,
_closeCbPromise: null,
next: [Function] }
そのが動作していないその更新を参照してください。 – Nane
rethinkDBに問題がありますか? – Nane
私は自分の答えを更新しました。カーソル上で 'toArray()'を呼び出す必要があるかもしれないと思います。トラブルシューティングのドキュメントをご覧ください:https://www.rethinkdb.com/docs/troubleshooting/ – dan