Meteor: EJSON is not defined

Meteor: EJSON is not defined,meteor,Meteor,I'm trying to use a private JSON file to add some simple template documents to the mongo collection if it is empty: if (Passions.find().count() === 0) { mockPassions = JSON.parse(Assets.getText("mockups/passions.json")); _.each(mockPassions.passions, function(passion) { return Passions.insert(passion); }); } I'm getting the error: ReferenceError: EJSON is not defined Does anyone have any clue? I'm using Meteor 0.6.5. Thanks

I'm trying to use a private JSON file to add some simple template documents to the mongo collection if it is empty:

if (Passions.find().count() === 0) {
  mockPassions = JSON.parse(Assets.getText("mockups/passions.json"));
  _.each(mockPassions.passions, function(passion) {
    return Passions.insert(passion);
  });
}

I'm getting the error:

ReferenceError: EJSON is not defined

Does anyone have any clue? I'm using Meteor 0.6.5.
Thanks


#1

You need to bring EJSON up to the global namespace via

meteor add ejson

In meteor 0.6.5 unless you explicitly tell it to, packages are namespaced into package


#2

Considering Latest Meteor 1.6, you can follow below steps:

A. First Approach [Independent of the meteor restart/stop/start]

  1. Edit .meteor/packages file and add 'ejson' to end of the file

B. Second Approach

  1. Stop Server if already running by pressing ctrl+c
  2. Run command meteor add ejson
  3. Restart Server using command meteor

#3

Thanks! Btw, EJSON should be lowercase: meteor add ejson

#4

or use another terminal window to add