 mongo   = require 'mongodb'
 log4js  = require 'log4js'
 config  = require('./config').mongo
-
+{daisy} = require "sinkrow"
 logFile = '/var/log/node/MongoDBApi.log'
 #log     = log4js.addAppender log4js.fileAppender(logFile), "[MongoDBApi]"
 log     = log4js.getLogger('[MongoDBApi]')

    id.substr 0, length

  getDbUsers : (dbName,callback)->
    

    db = new mongo.Db dbName, @server, native_parser: false
    db.open (err,db)=>

        log.error error = "[ERROR] can't open database #{dbName}: #{err}"
      else
        db.admin().authenticate @mongoUser, @mongoPass,(err,result)=>
          log.error err if err
          db.collection "system.users",(err,collection)=>
            log.error err if err
            collection.find({},{fields:user:1}).toArray (err,items)->
              log.error err if err
              usernames = []
              for user in items
                usernames.push user.user
              console.log "miki",usernames
              callback usernames

  fetchDatabaseList :(options, callback)->
    #
