使用.NET 2.0驱动程序获取MongoDB Collection统计信息

时间:2016-04-15 19:02:03

标签: c# .net mongodb

使用.NET 2.0驱动程序并假设:

def df(z,omega_m,omega_l):
    return 1/(np.sqrt(omega_m*(1+z)**3+(1-omega_m-omega_l)*(1+z)**2+omega_l))

def DL(z,omega_m,omega_l,H_0):      #   checked with Hubble's law with low z, it is consistent
    f,err_f=scipy.integrate.quad(df,0,z,args=(omega_m,omega_l))     #   it's evident err_f it's irrelevant

    if omega_m+omega_l==1:
        return 299792./H_0*(1+z)*f

    elif omega_m+omega_l<1:
        fk=np.sin(np.sqrt(np.absolute(1-omega_l-omega_m))*f)
        return 299792./H_0*(1+z)/np.sqrt(np.absolute(1-omega_m-omega_l))*fk

    elif omega_m+omega_l>1:
        fk=np.sinh(np.sqrt(np.absolute(1-omega_l-omega_m))*f)
        return 299792./H_0*(1+z)/np.sqrt(np.absolute(1-omega_m-omega_l))*fk


params=(0.3,0.7,73) #   starting values for minimization   omega_m, omega_l, H_0

def chi(params,z,d,d_err):   #   checked, this function works
    return (d-DL(z,params[0],params[1],params[2]))**2/d_err

minimization,minimization_cov=optimize.leastsq(chi,params,args=(z,d,d_err))

如何执行与shell命令等效的操作:

分贝[&#39; fs.files&#39]。统计();

1 个答案:

答案 0 :(得分:1)

找到它。

var command = new BsonDocumentCommand<BsonDocument>(new BsonDocument { { "collstats", "fs.files" } });
var stats = database.RunCommand(command);