小编Chr*_*itz的帖子

MongoDB :: MongoIds在各个集合中都是独一无二的吗?

我想知道:Mongo ID在同一个数据库中的不同集合中是否具有相同的值?

谢谢,

mongodb

48
推荐指数
1
解决办法
1万
查看次数

获取未捕获的类型错误:path.split 不是反应中的函数

我正在尝试对我的表单进行验证以做出反应。我选择了“react-hook-form”库。但我不断收到错误“Path.split 不是函数。即使在使用他们网站上给出的默认示例后,我也遇到了同样的错误。这是官方网站中给出的默认代码。

import React from "react";
import { useForm } from "react-hook-form";

export default function App() {
  const { register, handleSubmit, watch, errors } = useForm();
  const onSubmit = data => console.log(data);

  console.log(watch("example")); // watch input value by passing the name of it

  return (
    {/* "handleSubmit" will validate your inputs before invoking "onSubmit" */}
    <form onSubmit={handleSubmit(onSubmit)}>
    {/* register your input into the hook by invoking the "register" function */}
      <input name="example" defaultValue="test" ref={register} />
      
      {/* include validation with required …
Run Code Online (Sandbox Code Playgroud)

react-hook-form

38
推荐指数
3
解决办法
2万
查看次数

无法在mongodb中创建索引,"键太大而不能索引"

我在mongodb创建索引,有1000万条记录但是跟着错误

db.logcollection.ensureIndex({"Module":1})
{
        "createdCollectionAutomatically" : false,
        "numIndexesBefore" : 3,
        "ok" : 0,
        "errmsg" : "Btree::insert: key too large to index, failing play.logcollection.$Module_1 1100 { : \"RezGainUISystem.Net.WebException: The request was aborted: The request was canceled.\r\n   at System.Net.ConnectStream.InternalWrite(Boolean async, Byte...\" }",
        "code" : 17282
}
Run Code Online (Sandbox Code Playgroud)

请帮我看看如何在mongodb中创建索引,

mongodb mongodb-query

28
推荐指数
4
解决办法
3万
查看次数

我怎样才能获得atom.io的"Go to Declaration"来真正做到这一点?

在atom.io中,如果我在这里右键单击"wrappedlabel":

<label class="wrappedlabel">"Be Kind to Animammals - Kiss a Duckbilled Platypus Today"</label>
Run Code Online (Sandbox Code Playgroud)

......它用" 去宣言 " 取笑我

单击不会将我带到项目中的.css文件中的该类.

有没有办法让这个实际工作?如果是这样,它将是一个更甜的套房.让它告诉我"去声明",然后让我挂着比告诉我"去"[其他地方],但仍然......

html css atom-editor

27
推荐指数
2
解决办法
3万
查看次数

Chart JS +ng2-charts 不适用于 Angular+2

你好开发人员我一整天都在尝试在我的项目上实现图表,但是按照官方文档,我无法摆脱这个错误:

ERROR in ./node_modules/ng2-charts/__ivy_ngcc__/fesm2015/ng2-charts.js 317:8-21
"export 'pluginService' was not found in 'chart.js'
 node_modules/ng2-charts/lib/base-chart.directive.d.ts:4:59 - error TS2305: Module '"../../chart.js/types/index.esm"' has no exported member 
'ChartPoint'.
    
    4 import { ChartConfiguration, ChartDataSets, ChartOptions, ChartPoint, ChartType, PluginServiceGlobalRegistration, PluginServiceRegistrationOptions } from 'chart.js';
                                                                ~~~~~~~~~~
    node_modules/ng2-charts/lib/base-chart.directive.d.ts:4:82 - error TS2305: Module '"../../chart.js/types/index.esm"' has no exported member 
'PluginServiceGlobalRegistration'.
    
    4 import { ChartConfiguration, ChartDataSets, ChartOptions, ChartPoint, ChartType, PluginServiceGlobalRegistration, PluginServiceRegistrationOptions } from 'chart.js';
                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    node_modules/ng2-charts/lib/base-chart.directive.d.ts:4:115 - error TS2305: Module '"../../chart.js/types/index.esm"' has no exported member 'PluginServiceRegistrationOptions'.
    
    4 import { ChartConfiguration, ChartDataSets, ChartOptions, ChartPoint, …
Run Code Online (Sandbox Code Playgroud)

charts ng2-charts angular

27
推荐指数
3
解决办法
2万
查看次数

在来自不同域的iframe中运行Meteor应用程序

经过数周的工作,我现在终于准备好部署我的应用程序,以发现流星似乎没有在iframe中运行.当顶级窗口和iframe在同一个域上运行时,它可以正常工作,但在域不同时则不行.我在Chrome上遇到的错误是:

Uncaught SecurityError: Access to 'sessionStorage' is denied for this document. 
Run Code Online (Sandbox Code Playgroud)

在那个错误之后,Meteor的初始化似乎停止了,甚至连Meteor自身都没有被定义.

经过一番挖掘,我找到了这个参考和解释:http://www.w3.org/TR/webstorage/#user-tracking :" 阻止第三方存储 用户代理可能会限制对localStorage对象的访问,因为脚本来自于浏览上下文的顶级文档的域,例如拒绝访问在iframe中运行的其他域中的页面的API."

问题不是我的应用程序特有的.您可以使用流星图库中的任何演示应用程序并尝试将它们嵌入到具有iframe的另一个页面中,您将看到我的意思.

有没有办法解决?

编辑2014-01-07: 我已经尝试包装了一些在try-catch块中抛出异常的地方,但是给人的印象是,这太过于使流星瘫痪,以至于由于其他原因而无法正确初始化.

iframe meteor

17
推荐指数
1
解决办法
2807
查看次数

如何在 Ubuntu 22.04 上安装 Node.js 版本 18?

如何在 ubuntu 22.04 上安装 Node.js 版本 18?

cd ~
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
Run Code Online (Sandbox Code Playgroud)
sudo bash nodesource_setup.sh
Run Code Online (Sandbox Code Playgroud)
sudo apt install nodejs
Run Code Online (Sandbox Code Playgroud)

我多次尝试这些命令,但总是安装版本 v12.22.9。

要使用 React 构建应用程序,我需要 Node 14 或更高版本。

你有什么建议吗 ?

node.js npm

13
推荐指数
2
解决办法
3万
查看次数

使用DataTables(Meteor Tabular)在新行中绘制数组的每个元素

我正在使用实现DataTables的Meteor Tabular包.我正在尝试从Mongo集合创建一个表.该集合有一个表单文档

{
  input: Array[365],
  output: Array[365],
  date: Array[365]
}
Run Code Online (Sandbox Code Playgroud)

我使用以下代码在Meteor中定义表

TabularTables.MyTable = new Tabular.Table({
    name: "MyTable",
    collection: MyTable,
    columns: [
        {data: "input", title: "Input", searchable: false},
        {data: "output", title: "Output", searchable: false},
        {data: "date", title: "Date", searchable: false}
    ],
    order: [[1, "desc"]],
    pageLength: 10
});
Run Code Online (Sandbox Code Playgroud)

问题是,当绘制它时,每个变量的所有365个元素最终都在一个单元格中,所以我有一个大的行.我希望每个元素都在一个单独的行中创建,即

Input      Output      Date
input[0]   output[0]   date[0]
input[1]   output[1]   date[1]
Run Code Online (Sandbox Code Playgroud)

而它目前

Input            Output            Date
input[0...364]   output[0...364]   date[0...364]
Run Code Online (Sandbox Code Playgroud)

javascript datatables meteor

9
推荐指数
1
解决办法
518
查看次数

在流星0.8.0中删除插入的模板

我正在使用UI.render()和UI.insert()插入模板.

当我试图删除我插入的模板时,它似乎留在内存中并且不会调用被破坏的方法.

根据文档,如果我使用jquery删除元素,它应该清理属性.

我正在使用以下代码测试它:

的test.html:

<head>
  <title>removeTest</title>
    <style>
        #content {
            height: 500px;
            width: 500px;
            background-color: gray;
        }
    </style>
</head>    

<body><div id="content"></div></body>    

<template name="foo"><div id="{{id}}">Foo</div></template>
Run Code Online (Sandbox Code Playgroud)

test.js:

if (Meteor.isClient) {
    UI.body.events({
        "click": function(event) {
            var instance = UI.renderWithData(Template.foo, { });
            UI.insert(instance, $("#content")[0]);
        }
    });    

    Template.foo.created = function() {
        this.data.id = "handle";
        var self = this;
        this.x = setInterval(function() { console.log("running...") }, 1000);
        setTimeout(function() { $("#handle").remove() }, 1000);
    };    

    Template.foo.destroyed = function() {
        // never called.
        clearTimeout(this.x);
    };
}
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

谢谢.

meteor meteor-blaze

8
推荐指数
1
解决办法
2944
查看次数

AWS SAM - Esbuild 失败:找不到 esbuild

我正在使用“sam init”尝试使用带有 nodeJS 和 Typescript 的 AWS SAM,但是当我想使用“sam build”构建示例 hello-world-typescript 应用程序时,我收到以下消息:

Building codeuri: C:\RF\GitHub\rf-09-06\hello-world runtime: nodejs14.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}} architecture: x86_64 functions: ['HelloWorldFunction']
Running NodejsNpmEsbuildBuilder:CopySource
Running NodejsNpmEsbuildBuilder:NpmInstall
Running NodejsNpmEsbuildBuilder:EsbuildBundle

Build Failed
Error: NodejsNpmEsbuildBuilder:EsbuildBundle - Esbuild Failed: cannot find esbuild
Run Code Online (Sandbox Code Playgroud)

知道如何解决吗?

谢谢!

typescript aws-sam esbuild

7
推荐指数
3
解决办法
1万
查看次数