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.

Migration to 0.2.5 breaks MongoDB

See original GitHub issue

Issue type:

[ ] question [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [x] mongodb [ ] mssql [x] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[x] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Hi, I previously upgraded to 0.2.5 from 0.1.17, I run 2 connection 1 is mysql and mongodb, on mongodb it says ‘database name must be a string’ even i added database: ‘db_name’ in the config.

[
  {
    "type": "mysql",
    "host": "127.0.0.1",
    "name": "main",
    "port": 3306,
    "username": "root",
    "password": "root",
    "database": "milo",
    "synchronize": true,
    "entities": [
      "\/Users\/markmatute\/Desktop\/Projects\/milo-backend\/dist\/config\/..\/entity\/**\/*"
    ],
    "logging": [
      "error",
      "query",
      "schema"
    ],
    "logger": "advanced-console"
  },
  null,
  {
    "type": "mongodb",
    "name": "mongo",
    "url": "mongodb:\/\/127.0.0.1:27017\/milo",
    "entities": [
      "\/Users\/markmatute\/Desktop\/Projects\/milo-backend\/dist\/config\/..\/entities-mongo\/**\/*"
    ],
    "logging": [
      "error",
      "query",
      "schema"
    ],
    "logger": "advanced-console",
    "ssl": false,
    "sslValidate": false
  }
]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
n-lavrenkocommented, Sep 29, 2018

Guys, please, provide full example of using mongodb migration. Please! Here is my code: `import { getMongoManager, MigrationInterface, QueryRunner } from ‘typeorm’; import { User } from ‘…/…/api/models/User’; import { env } from ‘…/…/env’;

export class Init1538252088164 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<any> {
    const mongoManager = getMongoManager(env.db.connectionName);
    const user = new User();
    user.username = 'niklavr';
    user.email = 'lavrenonik@gmail.com';
    
    user.firstName = 'Nikita';
    user.lastName = 'Lavrenko';
    
    user.password = 'abra';
    
    await mongoManager.save(user);
}

public async down(queryRunner: QueryRunner): Promise<any> {
    // some code here
}

}

and log in console is: Error during migration run: Error: Check schema queries are not supported by MongoDB driver. at MongoQueryRunner.<anonymous> (/projects/rolly/api/src/driver/mongodb/MongoQueryRunner.ts:498:15) at step (/projects/rolly/api/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js:32:23) at Object.next (/projects/rolly/api/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js:13:53) at /projects/rolly/api/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js:7:71 at new Promise (<anonymous>) at __awaiter (/projects/rolly/api/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js:3:12) at MongoQueryRunner.hasTable (/projects/rolly/api/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js:659:16) at MigrationExecutor.<anonymous> (/projects/rolly/api/src/migration/MigrationExecutor.ts:219:46) at step (/projects/rolly/api/node_modules/typeorm/migration/MigrationExecutor.js:32:23) at Object.next (/projects/rolly/api/node_modules/typeorm/migration/MigrationExecutor.js:13:53)

Read more comments on GitHub >

github_iconTop Results From Across the Web

MongoDB 4.0 to 5.0 Migration - Installation & Upgrades
I have to migrate a MongoDB database in a 3-node replicaset in version 4.0 from one infra to another infra with MongoDB but...
Read more >
Migrating to Mongoose 6
There are several backwards-breaking changes you should be aware of when migrating from ... See the MongoDB Node drivers' migration guide for detailed...
Read more >
Can't Migrate Mongodb from version 3.4 to 3.6 using Meteor ...
We need to migrate our current Mongodb 3.4 to version 3.6 but the recommendations don't work. Mongo says that you need to send...
Read more >
Hangfire.Mongo 1.9.1 - NuGet
We sometimes introduce breaking changes in the schema. For this reason we have introduced migration. Three migration strategies exists.
Read more >
Changelog | Meteor API Docs
needs to use directly from npm the meteorjs/babel@7.16.1-beta.0. Breaking Changes. N/A. Migration Steps. Meteor Version Release. mongo@1.16.2 :.
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