0.1.3 • Published 12 months ago

@node-jeneralize/mti v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

NPM

mti -> mongo testdata inserter

Summary

This package can insert prepared documents into any MongoDB instance.
mti is inspired by gcp-kit/fti.

Basically use

1. install

$ npm i -D @node-jeneralize/mti

2. create document data, post

import { mti, InjectableCollectionModule } from '@node-jeneralize/mti';

const users: User[] = [...new Array(10)].map((_, index) => {
  return {
    name: `sampleUser: ${hoge}`,
    version: 0,
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  };
});

const usersCollection: InjectableCollectionModule<User> = {
  collectionName: 'users',
  documents: users,
};

mti({
  uri: 'mongodb://root:password@127.0.0.1:8080',
  dbName: 'sample',
  insertCollections: [usersCollection],
  clientOptions: {
    authSource: 'admin',
  },
}).then(() => {
  console.log('Succeed to post testdata in mongoDB!');
});

For more use cases, see docs.

License

MIT

0.1.3

12 months ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago