npm.io
0.0.8 • Published 7 years agoCLI

mongodb-get-props

Licence
MIT
Version
0.0.8
Deps
2
Size
120 kB
Vulns
0
Weekly
0

Build Status

install

npm i mongodb-get-props --save

usage

const getProps = require('mongodb-get-props')

;(async () => {

  const MongoClient = require('mongodb').MongoClient;

  const uri = 'mongodb://localhost:27017/db'

  const client = await MongoClient.connect(uri,{ useNewUrlParser: true });

  // database and collection name
  await getProps(client.db('project'), 'song')

  // sample output
  {
    __v: 'int',
    _id: 'objectId',
    artist_name: 'string',
    created_at: 'date',
    track_name: 'string',
    updated_at: 'date'
  }

})();

Keywords