• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


11 Jan, 2025

Updated at 23 Apr, 2025

Collection creation and removal after restored from full logical backup - Mongodb

Hi

Before full logical backup database status

admin 13.34 MiB
config 3.61 MiB
doublecollection 94.25 MiB
pitr 95.52 MiB
restore 259.36 MiB
restore-test-1 94.63 MiB
singlecollection 40.00 KiB
test1db 306.50 MiB
withoutcollections 40.00 KiB

after Full Logical backup I created collection1 db and added ducuments to the collection1 under collection1 db

[direct: mongos] collection1> show collections
collection1

collection1 size:

sharded: false,
size: 426,
count: 9,
numOrphanDocs: 0,
storageSize: 36864,
totalIndexSize: 36864,
totalSize: 73728,
indexSizes: { id: 36864 },
avgObjSize: 47,
ns: ‘collection1.collection1’,
nindexes: 1,
scaleFactor: 1

database status

[direct: mongos] test> show dbs
admin 13.34 MiB
collection1 72.00 KiB
config 3.61 MiB
doublecollection 94.25 MiB
pitr 95.52 MiB
restore 259.36 MiB
restore-test-1 94.63 MiB
singlecollection 40.00 KiB
test1db 306.50 MiB
withoutcollections 40.00 KiB

After restored from full logical backup database status

[direct: mongos] test> show dbs
admin 13.34 MiB
collection1 72.00 KiB
config 3.61 MiB
doublecollection 94.25 MiB
pitr 95.52 MiB
restore 259.36 MiB
restore-test-1 94.63 MiB
singlecollection 40.00 KiB
test1db 306.50 MiB
withoutcollections 40.00 KiB

[direct: mongos] test> use collection1
switched to db collection1
[direct: mongos] collection1> show collections

[direct: mongos] collection1>

I could see collection1 db size is 72.00 KiB even I couldn’t see any collections under collection1 and this is the expected behaviour of logical backup.

If I know the collection name created under collection1 db, I will bring back the removed collection again using the command - db.createCollection(“collection1”)

and if I don’t want, I will delete the collection permanently the same way using the command db.dropCollection() or db.dropDatabase() after bring back the removed collection.

what if I don’t know the collection name, how I can bring back the removed collection and how I can delete the removed collection permanently ?

1 post - 1 participant

Read full topic