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

Admin UI works but can't update records #104

Closed
surfer77 opened this issue Jun 12, 2019 · 2 comments
Closed

Admin UI works but can't update records #104

surfer77 opened this issue Jun 12, 2019 · 2 comments

Comments

@surfer77
Copy link

I can access /admin and see all my resources but when I edit something and and save it, it gives "There were errors in the record object. Check them out" no matter which record I try to update from different collections (some created only with one field of String for example for testing)

this is my admin.js route

const AdminBro = require("admin-bro");
const AdminBroExpress = require("admin-bro-expressjs");

const AdminBroMongoose = require("admin-bro-mongoose");
const mongoose = require("mongoose");

const User = require("../models/user.js");
const Api = require("../models/api.js");
const Query = require("../models/query.js");
const Company = require("../models/company.js");
const Collection = require("../models/collection.js");
const Comment = require("../models/comment.js");

AdminBro.registerAdapter(AdminBroMongoose);


// Passing resources one by one
const adminBro = new AdminBro({
	resources: [Api, User, Query, Company, Collection, Comment],
	rootPath: "/admin"
});

const router = AdminBroExpress.buildRouter(adminBro);

module.exports = router;
@surfer77
Copy link
Author

This is one of the errors I get in the console when I try to update any document:

  ok: 0,
  errmsg:
   'Updating the path \'createdAt\' would create a conflict at \'createdAt\'',

All of my docs always have createdAt

@surfer77
Copy link
Author

The problem was the mongoose-timestamp plugin and this fixed it:

drudge/mongoose-timestamp#48

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