Error when trying to compact a Mongo collection

Welcome back to the MongoDB Community Forums @Ian_Hannah !

“errmsg” : “collection name has invalid type object”

The issue is that you are providing an object (db.childdata) for the collection name to compact rather than the expected string value.

Something like the following should work:

db.runCommand({compact: "childdata"})

Note: code and log snippets are better as inline text. Images can be difficult to read (for example, this one seems to be oddly resized) and do not allow copying & pasting commands to reproduce issues.

Regards,
Stennie