mongojs.js 630 B

1234567891011121314151617181920212223242526272829
  1. /* eslint-disable
  2. max-len,
  3. */
  4. // TODO: This file was created by bulk-decaffeinate.
  5. // Fix any style issues and re-enable lint.
  6. const Settings = require('settings-sharelatex')
  7. const mongojs = require('mongojs')
  8. if (
  9. typeof global.beforeEach === 'function' &&
  10. process.argv.join(' ').match(/unit/)
  11. ) {
  12. throw new Error(
  13. 'It looks like unit tests are running, but you are connecting to Mongo. Missing a stub?'
  14. )
  15. }
  16. const db = mongojs(Settings.mongo.url, [
  17. 'projects',
  18. 'users',
  19. 'tokens',
  20. 'docSnapshots',
  21. 'projectHistoryFailures',
  22. 'deletedProjects'
  23. ])
  24. module.exports = {
  25. db,
  26. ObjectId: mongojs.ObjectId
  27. }