# Remove a Topic

To remove a Topic we use POST without payload but with a given id:

POST /api/removeTopic/5dde75915aad123cee5da6c9 HTTP/1.1
Content-Type: application/json

{}
1
2
3
4

As the second Topic didn't gain much attraction, we might decide to delete it. This should also remove it's thread entirely.

# Events collection

Topic.removed got added to events:

[...] // older events above
{
    "_id" : ObjectId("5dde84d05aad123cee5da6cd"),
    "aggregateId" : ObjectId("5dde75915aad123cee5da6c9"),
    "aggregateVersion" : NumberInt(1),
    "type" : "Topic.removed",
    "payload" : null,
    "context" : {
        "reqId" : "97440294-1c8d-4dae-8c4a-9189793d9460"
    }
}
1
2
3
4
5
6
7
8
9
10
11

# Topics collection

2nd Topic got deleted:

{
    "_id" : ObjectId("5dde6aab5aad123cee5da6c7"),
    "title" : "This is a 1st Topic",
    "countComments" : NumberInt(1)
}
1
2
3
4
5

# Threads collection

2nd Thread got deleted too:

{
    "_id" : ObjectId("5dde6aab5aad123cee5da6c7"),
    "title" : "This is a 1st Topic",
    "countComments" : NumberInt(1),
    "children" : [
        {
            "_id" : ObjectId("5dde77775aad123cee5da6cb"),
            "body" : "A 1st Comment on Topic #1",
            "countReplies" : NumberInt(0)
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
Last Updated: 11/27/2019, 3:58:28 PM