{"size": 896, "ext": "js", "max_stars_repo_path": "utils/reset-invoice.js", "max_stars_repo_name": "vtfk/tools-elevpc-faktura", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "utils/reset-invoice.js", "max_issues_repo_name": "vtfk/tools-elevpc-faktura", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "utils/reset-invoice.js", "max_forks_repo_name": "vtfk/tools-elevpc-faktura", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 40.7272727273, "max_line_length": 90, "alphanum_fraction": 0.6439732143}
(async () => {
  require('dotenv').config()
  const mongo = require('../lib/mongo')
  const logger = require('../lib/logger')
  const resetIds = require('../data/nullstilles.json')
  const shrdKey = process.env.MONGODB_SHARD_KEY
  const db = await mongo()
  const collection = db.collection(process.env.MONGODB_COLLECTION)
  logger('info', ['utils', 'reset-invoice', 'got ', resetIds.length, 'invoices to reset'])
  const query = {
    id: { $in: resetIds },
    batchId: { $exists: true },
    shrdKey
  }
  const data = await collection.find(query).toArray()
  logger('info', ['utils', 'reset-invoice', 'got ', data.length, 'invoices on record'])
  const ids = data.map(record => record._id)
  await collection.updateMany({ _id: { $in: ids }, shrdKey }, { $unset: { batchId: '' } })
  logger('info', ['utils', 'reset-invoice', 'got ', data.length, 'removed from batch'])
  process.exit(0)
})()
