Delete a collection
Solution
Use the Delete
function:
{
ref: Collection("dilapidated_huts"),
ts: 1635183086600000,
history_days: 30,
name: 'dilapidated_huts',
data: { env: 'test' }
}
{'ref': Ref(id=dilapidated_huts, collection=Ref(id=collections)), 'ts': 1635183090850000, 'history_days': 30, 'name': 'dilapidated_huts', 'data': {'env': 'test'}}
map[data:map[env:test] history_days:30 name:dilapidated_huts ref:{dilapidated_huts 0xc0001844b0 0xc0001844b0 <nil>} ts:1635183036860000]
ObjectV(ref: RefV(id = "dilapidated_huts", collection = RefV(id = "collections")),ts: LongV(1635183024850000),history_days: LongV(30),name: StringV(dilapidated_huts),data: ObjectV(env: StringV(test)))
{ref: ref(id = "dilapidated_huts", collection = ref(id = "collections")), ts: 1635183075770000, history_days: 30, name: "dilapidated_huts", data: {env: "test"}}
{
ref: Collection("dilapidated_huts"),
ts: 1635183253930000,
history_days: 30,
name: 'dilapidated_huts',
data: { env: 'test' }
}
Discussion
When a collection is deleted:
-
All of the documents contained in the collection are also deleted.
-
Any indexes with a single
source
matching the collection are also deleted. -
Any indexes that have multiple source collections are not deleted.
-
References to the collection, or to documents within the collection, that are stored in any documents outside of the collection, are not modified and are no longer valid.