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

Custom ID Not working #189

Closed
dottodot opened this issue May 4, 2017 · 1 comment
Closed

Custom ID Not working #189

dottodot opened this issue May 4, 2017 · 1 comment

Comments

@dottodot
Copy link

dottodot commented May 4, 2017

When using the lastest version of feathers the custom id option doesn't seem to work anymore

const createService = require("feathers-mongoose");
const createModel = require("../../models/page.model");
const hooks = require("./page.hooks");
const filters = require("./page.filters");

module.exports = function() {
  const app = this;
  const Model = createModel(app);
  const paginate = app.get("paginate");

  const options = {
    name: "page",
    id: "slug",
    Model,
    paginate
  };

  // Initialize our service with any options it requires
  app.use("/page", createService(options));

  // Get our initialized service so that we can register hooks and filters
  const service = app.service("page");

  service.hooks(hooks);

  if (service.filter) {
    service.filter(filters);
  }
};

this just gives the error

Cast to ObjectId failed for value "story" at path "_id" for model "page"
@juanpujol
Copy link

This is because of an update on Mongoose. had the same Issue.

https://github.com/Automattic/mongoose/blob/master/History.md#4101--2017-05-21

"fix(schema): enforce that _id is never null #5236"

Just lock you Mongoose to v4.10.0 and should work.

@daffl daffl closed this as completed Aug 14, 2017
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

3 participants