小编Ric*_*cky的帖子

MongoDB listCollections 过滤器

我正在使用 node.js

我正在尝试过滤我必须排除集合“出口”并检索所有其他集合的集合,但我似乎无法弄清楚语法。我试过了:

db.listCollections({filter: 'outlets'}).toArray((err, docs)
Run Code Online (Sandbox Code Playgroud)

有什么建议?

mongodb

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

Mongo Find()函数不会排除_id

你好我似乎无法让exclude _id工作,这是代码

const findLabels = (db, cb) => {
  // Get the documents collection
  const collection = db.collection(documentName);

  // Find some documents
  collection.find({}, { _id: 0 }).toArray((err, docs) => {
    // An error occurred we need to return that to the given 
    // callback function
    if (err) {
      return cb(err);
    }

    assert.equal(err, null);
    console.log("Found the following records");
    console.log(docs)

    return cb(null, docs);
  });
}
Run Code Online (Sandbox Code Playgroud)

这是控制台日志中的输出

Found the following records
[ { _id: 5a5ee78cc130e727a3b1fdb6, name: 'Downgradeklajds' },
  { _id: 5a5ee794c130e727a3b1fdb7, Pizel: '00:00:07' …
Run Code Online (Sandbox Code Playgroud)

mongodb

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

Jquery $(this).val()不起作用

我在使用jquery将值设置为调用函数的元素时遇到问题.这是代码

元件:

 each outlet in FBoutlets  
        br
        label(for='FBoutlet') Facebook: #{outlet.FBoutlets.name}  
        input(type='checkbox', value='', onchange="streamFB(" + outlet.FBoutlets.FBpageId + "," + JSON.stringify(outlet.FBoutlets.FBaccessToken) + ")", name='FBoutletCredentials', id='FBoutlet')
Run Code Online (Sandbox Code Playgroud)

功能:

  script.
    window.fbAsyncInit  = function()  {
    FB.init({
      appId             : '20212222222',
      autoLogAppEvents  : true,
      xfbml             : true,
      version           : 'v2.12'
      });
      };

    function streamFB(pageId, accessToken){
      FB.api(
        '/' + pageId + '/live_videos',
        'POST',
        {access_token: accessToken},
        function(response) {
            let rtmp = response.stream_url
            console.log(rtmp)
            console.log(response)
            $(this).val() = rtmp;
        }
      );
    }
Run Code Online (Sandbox Code Playgroud)

$(this).val()返回undefined,我需要使用它,因为元素id是动态生成的

javascript debugging jquery pug

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

ffmpeg如何获取持续时间到node.js?

好的,我知道如何使用以下命令在ffmpeg中获取视频的时长

ffmpeg -i ./output/sample.mp4 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//
Run Code Online (Sandbox Code Playgroud)

我通过node中的一个函数运行此命令,但这将持续时间输出到控制台上,如何在需要的地方将其保存到node.js上?

ffmpeg node.js

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

标签 统计

mongodb ×2

debugging ×1

ffmpeg ×1

javascript ×1

jquery ×1

node.js ×1

pug ×1