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.

Simple-Schema: TypeError: Object [object Object] has no method 'attachSchema'

See original GitHub issue

Hi,

I’m running Meteor 0.9.1.1 and I keep getting issues with simple-schema:

$ meteor
[[[[[ ~/game ]]]]]

=> Started proxy.
=> Started MongoDB.     
W20140907-08:06:03.233(-7)? (STDERR) 
W20140907-08:06:03.357(-7)? (STDERR) /home/me/.meteor/packages/meteor-tool/.1.0.28.tx8gz++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20140907-08:06:03.358(-7)? (STDERR)                        throw(ex);
W20140907-08:06:03.362(-7)? (STDERR)                              ^
W20140907-08:06:03.363(-7)? (STDERR) TypeError: Object [object Object] has no method 'attachSchema'
W20140907-08:06:03.364(-7)? (STDERR)     at app/lib/schema-Account-Type.js:22:13
W20140907-08:06:03.365(-7)? (STDERR)     at app/lib/schema-Account-Type.js:25:3
W20140907-08:06:03.365(-7)? (STDERR)     at /home/me/game/.meteor/local/build/programs/server/boot.js:161:10
W20140907-08:06:03.365(-7)? (STDERR)     at Array.forEach (native)
W20140907-08:06:03.366(-7)? (STDERR)     at Function._.each._.forEach (/home/me/.meteor/packages/meteor-tool/.1.0.28.tx8gz++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20140907-08:06:03.366(-7)? (STDERR)     at /home/me/game/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8

This is the file that contains my schema:

AccountType = new Meteor.Collection("AccountType");
Schema = {};
Schema.AccountType = new SimpleSchema({
    accountType: {
        type: String,
        allowedValues: ['test', 'live']
    },
    createdBy: {
        type: String,
        autoValue: function(){ return this.userId }
    }
});

SimpleSchema.debug = true;
AccountType.attachSchema(Schema.AccountType);

This schema was previously working on an earlier version of Meteor.

Any ideas what the issue with this could be?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mvgallecommented, Jun 6, 2016

In your terminal try adding the following package to your application :

meteor add aldeed:collection2

Solved the problem for me. 😃

0reactions
oruchepaschalcommented, Sep 22, 2017

Had same issues with meteor app: “ReferenceError: SimpleSchema is not defined” open terminal in the project folder and type the following command meteor add aldeed:collection2 result: **Changes to your project’s package version selections:

aldeed:collection2 added, version 2.7.1 aldeed:simple-schema added, version 1.5.3 mdg:validation-error added, version 0.2.0**

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Object [object Object] has no method 'attachSchema ...
I am using Meteor 1.0 , and i getting this error in application startup after installing the package : TypeError: Object [object Object]...
Read more >
SimpleSchema/Collection2 insert exception - Stack Overflow
I'm trying to get a single text field to insert a string into my collection. I'm getting this error: Exception while invoking method ......
Read more >
Question regarding Schemas - help - Meteor forums
Im trying to get up and running with the cosio55:autoform-cloudinary package. ... TypeError: Object [object Object] has no method 'attachSchema'.
Read more >
E43: Experience Simple Schema | ICS 314, Fall 2019
SimpleSchema takes an object as its argument which defines key-value pairs to specify constraints on a Mongo document. In this case, we are ......
Read more >
aldeed:simple-schema - Packosphere
no objects in the object you are validating, there is no validation error for "friends.$.name". When the friends array does have objects, every...
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