小编The*_*son的帖子

为什么mongoose打开两个连接?

这是一个来自猫鼬快速指南的简单文件

mongoose.js

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/Chat');

var userSchema = mongoose.Schema({
  name: String
});

var User = mongoose.model('User', userSchema);
var user = new User({name: 'Andy'});

user.save(); // if i comment it mongoose will keep one connection

User.find({}, function(err, data) { console.log(data); }); // the same if i comment it
Run Code Online (Sandbox Code Playgroud)

我尝试使用db.once方法,但效果相同.

为什么mongoose会在这种情况下打开第二个连接?

MongoDB的

mongoose mongodb node.js

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

Dispose,Finalize,SuppressFinalize方法

我可以在同一个类中实现这两个方法吗?

public class MyClass : IDisposable
{
  // some implementation
  // if i missed to call Dispose() method;
  ~MyClass()
  {
  // it means, clear all does not mananage resources 
  // but dont use Dispose() method 
  }
  public void Dispose()
  {
   // clear resources
   // if i call this method will i can do this:
   GC.SuppressFinalize()
   // it means dont use Finalizw method for this object
  }
}
Run Code Online (Sandbox Code Playgroud)

我对吗?因为我无法理解这个GC.SuppressFinalize()方法?

c# garbage-collection

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

如何使用Progress 4gl中的参数从List执行过程?

我有一些这样的清单

DEFINE VARIABLE procedurelist AS CHARACTER EXTENT 5
    INITIAL [ "1.p", "2.p", "3.p", "4.p", "5.p"].
Run Code Online (Sandbox Code Playgroud)

但这个带输入输出参数的所有程序,我想执行这个程序,我该怎么做?我不知道该怎么做.

progress-4gl openedge

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