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

Unexpected error on assocaitions for sails 0.12.3 #148

Closed
enricodeleo opened this issue Jun 3, 2016 · 2 comments
Closed

Unexpected error on assocaitions for sails 0.12.3 #148

enricodeleo opened this issue Jun 3, 2016 · 2 comments

Comments

@enricodeleo
Copy link

Hi!

I'm developing a basic blogging app to learn sails.js. As for any blog I'm trying to create two kind of relationship on "Post" model: related and categories.
The former relations is a many-to-many relation with model "Category", the latter is a many-to-many relation with the model "Post" itself.

At first, I tried on sails.js v0.11.4 (I used a scaffolder) and creating new posts with those relations turned out into Orientdb messages stating that it couldn't create vertex.

I tried the following:

  • Updated sails-orientdb with master version on github (same error appeared)
  • Updated sails.js to 0.12.3 now the error is a generic "unknown error"

Environment

  • OSX El Capitan
  • Nodejs version 5.1.1 (installed via brew's nvm)
  • Orientdb version 2.1.13 (via brew)

Models

// api/models/Post.js
"use strict";
module.exports = {
  schema: true,
  attributes: {

    title: {
      type: 'string',
      required: true
    },

    content: {
      type: 'text'
    },

    excerpt: {
      type: 'text'
    },

    categories: {
      collection: 'category',
      via: 'posts'
    },

    related: {
      collection: 'post',
      via: 'related'
    },

    toJSON() {
      return this.toObject();
    }

  },

  beforeUpdate: (values, next) => next(),
  beforeCreate: (values, next) => next()
};

and

// api/models/Category.js
"use strict";
module.exports = {
  schema: true,
  attributes: {

    name: {
      type: 'string',
      required: true
    },

    description: {
      type: 'string'
    },

    posts: {
      collection: 'post',
      via: 'categories'
    },

    toJSON() {
      return this.toObject();
    }

  },

  beforeUpdate: (values, next) => next(),
  beforeCreate: (values, next) => next()
};

Any ideas?

@dmarcelino
Copy link
Member

Hi @enricodeleo, have you tried with OrientDB v2.0? OrientDB v2.1 is not supported yet, check #52.

@dmarcelino
Copy link
Member

Please reopen if you are experiencing this on OrientDB v2.0, otherwise add a comment to #52. Thanks

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

2 participants