小编Sha*_*ari的帖子

如何在Html和meteor中获取没有“ObjectID”字符串的mongodb中的id

在 mongodb 中获取 id 时,我得到这样的 id。

    ObjectID("55545a387d55e6f2a67ff6a0")
Run Code Online (Sandbox Code Playgroud)

有什么办法可以得到id吗

   55545a387d55e6f2a67ff6a0
Run Code Online (Sandbox Code Playgroud)

html mongodb

6
推荐指数
2
解决办法
4408
查看次数

如何在流星中从动态生成的表单中获取文本框的值,而文本框的数量不固定

我想从动态生成的表单中获取文本框的值并存储在数据库中.文本框的数量不固定.表单位于模板中.

    <template name="product">
     <input type="text" id="txt1">
     <input type="text" id="txt2">
     .......
     .......
     <button id="CreateNewProduct">Create new product</button>
    </template>
Run Code Online (Sandbox Code Playgroud)

我想在"product"集合中插入文本框值.我刚刚在这里展示了两个文本框供参考.它可能是3,4,5,......最多n个.它也可能包含复选框和收音机.

你能建议我如何继续这项任务吗?

html javascript meteor

6
推荐指数
1
解决办法
678
查看次数

使用 fabric.js 绘制矩形

这是我用fabric.js 绘制矩形的代码,但我没有得到确切的结果。我正在使用 fabric.js 在画布上用 HTML 绘制一个矩形

<canvas id="canvas2" width=500 height=500 style="height:500px;width:500px;"></canvas>
Run Code Online (Sandbox Code Playgroud)

我的JS代码是:

var canvas = new fabric.Canvas("canvas2");
var rectangle, isDown, origX, origY;

canvas.on('mouse:down', function(o){
    var pointer = canvas.getPointer(o.e);

    isDown = true;
    origX = pointer.x;
    origY = pointer.y;

    rectangle = new fabric.Rect({
        left: origX,
        top: origY,
        fill: '',
        stroke: 'red',
        strokeWidth: 3,
    });
    canvas.add(rectangle);
});

canvas.on('mouse:move', function(o){
    if (!isDown) return;
    var pointer = canvas.getPointer(o.e);
    canvas.renderAll();
});

canvas.on('mouse:up', function(o){
    isDown = false;
});
Run Code Online (Sandbox Code Playgroud)

javascript fabricjs

4
推荐指数
1
解决办法
4164
查看次数

mongodb投影查询中的第一个{}大括号是什么意思

我想知道{}在此查询中找到这里后,需要第一个大括号是什么。

db.mycol.find({},{"title":1,_id:0})
Run Code Online (Sandbox Code Playgroud)

mongodb

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

标签 统计

html ×2

javascript ×2

mongodb ×2

fabricjs ×1

meteor ×1