We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have written the following migration that works fine if run from the server/main.js file ...
import '../imports/startup/server'; import { Meteor } from 'meteor/meteor'; import { Migrations } from 'meteor/percolate:migrations'; import { Tags } from '../imports/api/collections/tags/tags.js'; Migrations.add({ 'version': 1, 'name': "Add multi practice capability to user.", 'up': function(){ // the users are assumed to be the owner. const ownerTagId = Tags.findOne({name: "Practice Owner"})._id; if(!ownerTagId){ return; } const search = { $and: [ {practiceId: { $exists: true }}, {practices: { $exists: false }} ]}; let users = Meteor.users.find(search); users.forEach(user =>{ const practice = { id: user.practiceId, tags: [ ownerTagId ], active: true }; const practices = [practice]; Meteor.users.update(user._id, {$set: {practices: practices}}); }); }, 'down': function(){ const users = Meteor.users.find(); users.forEach((user)=>{ Meteor.users.update(user._id, { $unset: { practices: "" } }); }); } }); Meteor.startup(()=>{ Migrations.migrateTo(1); });
However I really wanted to have a separate migrations.js file or maybe even one per version to sit in the /imports/startup/server folder.
However when trying to run that way - despite having all imports working, I get an error like this:
W20161111-23:36:20.538(0)? (STDERR) TypeError: Cannot read property 'findOne' of undefined W20161111-23:36:20.539(0)? (STDERR) at Object.Migrations.getControl (packages/percolatemigrations.js:269:33) W20161111-23:36:20.539(0)? (STDERR) at Object.Migrations.migrateTo (packages/percolatemigrations.js:185:22) W20161111-23:36:20.540(0)? (STDERR) at Object.Migrations.migrateTo (packages/percolate_migrations.js:167:10) W20161111-23:36:20.540(0)? (STDERR) at meteorInstall.imports.startup.server.initializeApplication.js (imports/startup/server/initializeApplication.js:60:12) W20161111-23:36:20.541(0)? (STDERR) at fileEvaluate (packages/modules-runtime.js:181:9) W20161111-23:36:20.541(0)? (STDERR) at Module.require (packages/modules-runtime.js:106:16) W20161111-23:36:20.541(0)? (STDERR) at Module.Mp.import (/home/hans/.meteor/packages/modules/.0.7.7.4uxp90++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16) W20161111-23:36:20.542(0)? (STDERR) at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:1:1) W20161111-23:36:20.542(0)? (STDERR) at fileEvaluate (packages/modules-runtime.js:181:9) W20161111-23:36:20.543(0)? (STDERR) at Module.require (packages/modules-runtime.js:106:16) => Exited with code: 1
It appears that Migrations._collecction is not defined in the getControl method.
The text was updated successfully, but these errors were encountered:
I've encountered the same issue
Sorry, something went wrong.
any solution for this I'm running my migration in a different file which is getting called in main.js but i get this error
No branches or pull requests
I have written the following migration that works fine if run from the server/main.js file ...
However I really wanted to have a separate migrations.js file or maybe even one per version to sit in the /imports/startup/server folder.
However when trying to run that way - despite having all imports working, I get an error like this:
It appears that Migrations._collecction is not defined in the getControl method.
The text was updated successfully, but these errors were encountered: