db-migrate / db-migrate/mongodb

Promises not removing the document in migration

Open
#39 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
25
Forks
57
PR merge metrics
No merged PRs in 30d

Description

## I'm submitting a...

- [x] Bug report
- [ ] Feature request
- [ ] Question

## Current behaviour
```
exports.down = function(db) {
return db.dropTable("pets");
};

// Returns:
[INFO] Defaulting to running 1 down migration.
collection migrations
collection pets

```
The code above remove the collection `pets` but doesn't remove the document in the migration collection.

```
exports.down = function(db, callback) {
db.dropTable("pets1", callback);
};

// Returns:
[INFO] Defaulting to running 1 down migration.
collection migrations
collection pets1
[INFO] Processed migration 20190704145216-yop2
[INFO] Done
```
The code above works as expected, it removes the collection `pets1` and remove the right document in the migration collection.

## Expected behaviour
It should remove the right document in the migration collection when it succeed.

## Environment



db-migrate@0.11.6
db-migrate-mongodb@1.5.0
Node version: v12.4.0
Platform: Mac

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/78362554-promises-not-removing-the-document-in-migration?utm_campaign=plugin&utm_content=tracker%2F12293389&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12293389&utm_medium=issues&utm_source=github).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the promise-returning exports.down migration from the issue, then compare its completion path with the callback-based exports.down example. Trace the MongoDB migration handling until the migration document is removed; done means the pets collection and its corresponding migration document are both removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.