Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of cross-modules Schema definitions? #24

Open
mgcrea opened this issue Dec 18, 2015 · 0 comments
Open

Support of cross-modules Schema definitions? #24

mgcrea opened this issue Dec 18, 2015 · 0 comments

Comments

@mgcrea
Copy link

mgcrea commented Dec 18, 2015

I have a specific need of supporting schema (camo's Document) definitions accross modules:

With a basic schema:

import {Document} from 'camo';

export default class User extends Document {
  constructor() {
    super();
    this.name = String;
    this.breed = String;
  }
}

Required from another module:

const uri = 'mongodb://127.0.0.1:27017/core';
log.info('Connecting to database uri="%s"...', uri);
connect(uri).then(db => {
  log.info('Connected to database uri="%s"', uri);
  return;
})
.then(() => {
  log.debug('creating...');
  const lassie = User.create({
    name: 'Lassie'
  });
  log.debug('saving...', lassie);
  return lassie.save().then((l) => {
    log.debug(l.id);
  });
})
.then(() => {
  return User.loadOne({name: 'Lassie'}).then((l) => {
    log.debug('Got Lassie!');
    log.debug('Her unique ID is', l.id);
  });
});

With latest version, this currently hangs on User.create.

More specifically, it looks like that it is this line that do hang:

super();

Which is compiled by babel 6 to something like:

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(User).call(this));

Any idea where this could come from or where should I look into?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant