我试图从谷歌找到一种方法,但结果可以保持不变
http://localhost:8000/socket.io/?EIO=3&transport=polling&t=MnHYrvR
我尝试这个 wan medium尝试其他方法,结果保持不变
对于我尝试过的前端,钩子组件内和范围外的socket io,结果保持不变
http://localhost:8000/socket.io/?EIO=3&transport=polling&t=MnHYrvR
这是我来自服务器的代码:
app.prepare().then(() => {
const server = express();
const setServer = require('http').Server(server);
const io = require('socket.io')(setServer)
server.use(bodyParser.json());
server.use(cookieParser());
io.on('connection', socket => {
console.log('socket', socket);
socket.emit('now', {
message: 'zeit'
})
})
server.use(routers)
server.get('*', (req, res) => {
return handle(req, res);
});
server.use( (err, req, res, next) => {
console.log(err)
if(err.name === 'Error'){
res.status(401).send({
title: 'error',
detail: 'Unauthorized Access!'
})
}
})
server.listen(port, err => {
if (err) throw err;
console.log(`> Ready on …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过合并另一个集合进行查询,但是运行查询时会遇到障碍,生成的数据不是我想象的
我有这样的数据
{
"_id": "5ce8981a46039c14a4ec32d1",
"name": "Monkey D Luffy",
"email": "aaa@aaa.com",
"status": "not verified",
"password": "$2a$10$ayluBIsOOelBTIk.69GjHubgQemr6dJfgBUELNusCOaUGLpS/qKs6",
"metas": {
"role": "admin",
"smartphone": "ios",
"address": "konoha",
"hobby": "eat ramen"
}
},
Run Code Online (Sandbox Code Playgroud)
我想从嵌套文档中提取metas:
{
"_id": "5ce8981a46039c14a4ec32d1",
"name": "Monkey D Luffy",
"email": "aaa@aaa.com",
"status": "not verified",
"password": "$2a$10$ayluBIsOOelBTIk.69GjHubgQemr6dJfgBUELNusCOaUGLpS/qKs6",
"role": "admin",
"smartphone": "ios",
"address": "konoha",
"hobby": "eat ramen"
},
Run Code Online (Sandbox Code Playgroud)
如果我的问题中有任何重复请建议我,因为我没有找到相同的问题,主要是使用数组。
这是我的查询:
db.accounts.aggregate([
{
$lookup: {
from: "account_meta",
localField: "_id",
foreignField: "account_id",
as: "metas"
}
},
{ "$unwind": "$metas" },
{
$group: {
_id: "$_id",
name: …Run Code Online (Sandbox Code Playgroud) 所以我做了一个项目,使用 react js 和 umi js 和 antd 作为附加依赖项,
当我接到禁用 antd 表中每一行的任务时遇到了问题,
我试图阅读文档 antd 但一无所获,
你有可能做到吗?或者有另一种可能的方法来做到这一点
感谢您的帮助
这是我的代码:
/* eslint-disable */
import React, { useState, useEffect, useRef } from 'react';
import { Modal, Button, Select, message, Radio, Table, Alert } from 'antd';
import _ from 'lodash';
import axios from 'axios';
import cookies from 'js-cookie';
import {_getCurrentBusiness} from '../../../utils/utils_business';
import {formatMessage } from 'umi-plugin-locale';
function DeleteConfirm (props) {
const user_auth = cookies.getJSON('ckmsbp');
const business = _getCurrentBusiness();
const [radio, setRadio] = useState('all'); …Run Code Online (Sandbox Code Playgroud)