question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem when attach on "aldeed:collection2-core"

See original GitHub issue

I tried aldeed:collection2-core, simpl-schema2, but have problem on Posts.attachSchema(Posts.schema)

import {Mongo} from 'meteor/mongo';
import SimpleSchema2 from 'simpl-schema';
// import { SimpleSchema } from 'meteor/aldeed:simple-schema';

const Posts = new Mongo.Collection('posts');

Posts.schema = new SimpleSchema2({
  createdDate: {
    type: Date,
  },
  title: {
    type: String,
  },
  body: {
    type: String,
  },
});

Posts.attachSchema(Posts.schema);
export default Posts;

It show

 Error: Invalid definition for pick field.
W20170329-10:07:49.304(7)? (STDERR)     at packages/aldeed_simple-schema.js:1429:13
W20170329-10:07:49.304(7)? (STDERR)     at Function._.each._.forEach (packages/underscore.js:147:22)
W20170329-10:07:49.304(7)? (STDERR)     at [object Object].SimpleSchema (packages/aldeed_simple-schema.js:1426:5)
W20170329-10:07:49.304(7)? (STDERR)     at [object Object].c2AttachSchema [as attachSchema] (packages/aldeed_collection2-core.js:62:10)
W20170329-10:07:49.305(7)? (STDERR)     at meteorInstall.imports.api.posts.posts.js (imports/api/posts/posts.js:27:16)
W20170329-10:07:49.305(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
W20170329-10:07:49.305(7)? (STDERR)     at Module.require (packages/modules-runtime.js:120:16)
W20170329-10:07:49.305(7)? (STDERR)     at Module.Mp.importSync (/Users/theara/.meteor/packages/modules/.0.9.0-beta.13.ag5gz5++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:88:16)
W20170329-10:07:49.306(7)? (STDERR)     at meteorInstall.imports.api.posts.methods.js (imports/api/posts/methods.js:1:1)
W20170329-10:07:49.306(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)

And then I tried to remove Posts.attachSchema(Posts.schema);, It work fine.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:27

github_iconTop GitHub Comments

5reactions
tamacticommented, Mar 31, 2017

Right now it’s possible to use another approach as described here: { friends: { type: Array }, 'friends.$': { type: String }, } Actually, there mentioned that we can use { friends: [String], } but it doesn’t work.

2reactions
SevenZarkcommented, Jul 12, 2017

My problem turned out to be that, for some reason, when I added an unspecified version of collection2-core, I wound up with an older version. Per the advice of somebody in a different thread, I uninstalled all the old aldeed stuff, then did this:

meteor add aldeed:collection2-core@2.0.1

This fixed my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attachment Error in Gmail - Quick FIX - YouTube
The files you want to attach to or download from an email do not attach or download. Sometimes, the problem lies not with...
Read more >
"attach" instead of "start" issue - Visual Studio Feedback
I saved a project with a small amount of code onto a folder called "coding" in my documents folder. The next day i...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found