Questions tagged [migrate-mongo]

12 questions
5
votes
0 answers

How to handle simultaneous running in migrate-mongo

I'm working on migration mechanism that should effect db changes between versions using npm package migrate-mongo. (https://www.npmjs.com/package/migrate-mongo) I've set the code to run on server init. By the package documentation when I use the…
Oren Banda
  • 51
  • 2
3
votes
0 answers

How to include migration schema files in webpack build

Issue When building the application with Webpack into a single bundle, the library migrate-mongo is unable to find the migration schema module eg migrations/[some-number]-[some-name]-migration.js. This is probably due to the dynamic import of the…
Marko Kovačević
  • 421
  • 1
  • 4
  • 17
1
vote
1 answer

Migrate-mongo autogenerated id-s in different environments

I use migrate-mongo to run my migrations across dev/stage/prod environments. For my documents I use the autogenerated mongo id-s. But when I run an insertion script like this let result = await db.collection("regions").insertMany( [{ …
Karen Avdalyan
  • 382
  • 1
  • 20
1
vote
1 answer

Is there a way to validate a UUID inserted in a mongoDB using mongo's validator?

I am using migrate-mongo for managing my database migration and I am trying to create a new migration that create a collection with a validator and insert values in it. I want to use a UUID for the _id property and I am using the uuid-mongodb…
Vico
  • 308
  • 2
  • 7
0
votes
0 answers

nestjs- Cannot up migrations with migrate-mongo

i am developing a nestjs application where i am using the package migrate-mongo, i have init the migrate-mongo command with npx migrate-mongo -m esm init then i had to add "type" : "module" in my package.json, also this is my migrate-mongo-config.js…
0
votes
0 answers

how can I connect mongoose with migrate-mongo

I want to do db migration with migrate-mongo and I want to connect mongoose in migrate-mongo-config.js file. how can I do it? I want to do db migration with migrate-mongo and I want to connect mongoose in migrate-mongo-config.js file. how can I do…
0
votes
1 answer

MongoServerError: Cannot create new indexes on existing collection xxxx.xxxx in a multi-document transaction

I'm using migrate-mongo and get the following error when trying to run some migrations. ~$ npx migrate-mongo up ERROR: Could not migrate up 20221201223533-add-indexes.js: Cannot create new indexes on existing collection xxx.xxx in a multi-document…
darksinge
  • 1,828
  • 1
  • 21
  • 32
0
votes
1 answer

Cannot read property 'drop' of undefined in simple migration

I'm using the migrate-mongo library and have this simple migration to create a view. However I'm getting an error on migrate down. ERROR: Could not migrate down 20220620114132-CreateContentView.js: Cannot read property 'drop' of…
0
votes
1 answer

Update a field to be further nested in a document - MongoDB/Node

I am writing a migration with migrate-mongo and the Node driver for Mongo which both have not-so-great documentation. I am trying to take a field and nest it one level further. Here is an example of the original structure: { "_id":…
R. Jutras
  • 331
  • 1
  • 4
  • 14
0
votes
1 answer

UpdateMany in mongodb using value of other field

I have this document in mongodb: _id: "xxxx", "timestamp": ISODate("2022-03-26T10:33:47.738Z") I would like to create a migration that will copy over timestamp to timestamp2 field. Something like this: db.task.updateMany( { "timestamp2": {…
nanakondor
  • 615
  • 11
  • 25
0
votes
1 answer

So MongoDB migration scripts...?

Given I'm trying to keep track of changes made on my Mongo DB. I decided to make use of a little package called migrate-mongo. (https://www.npmjs.com/package/migrate-mongo) Now my question is the following. I understand that this will keep track of…
Jack.c
  • 1,035
  • 1
  • 11
  • 14
0
votes
1 answer

How to migrate DOWN the MongoDB

I am using migrate-mongo library. I need to add some users to the application, so my colleagues can start working on it. My migrate up, is adding the users as expected, but the DOWN is not working. Well, actually, when I run the DOWN, nothing…
Amiga500
  • 5,874
  • 10
  • 64
  • 117