Could I remove doc by real collection name in Mongodb?

I have like this

myCollection = new Mongo.Collection('my_collection');
myCollection.insert({...........});

// but I want to remove any doc by real name
my_collection.remove(.....);
// don't 
myCollection.remove(........); 

Please help me.

myCollection is a collection object that refers to set of methods to access my_collection

if you want to remove a doc from that collection, you must use its .remove() method, which is only available via the collection object

Maybe if you told us why you want to do it that way, we could offer a solution.

I create the Backup and Restore tool for my project.
So I want to remove any docs before Restore, but I would like to use the real collection name in Mongodb directly.
Ex: in Mongodb cmd: db.my_collection.remove…
Please help me.

so myCollection._name ?

Thanks for your reply.
I don’t want to get the collection name, I would like to use real collection name to access the Mongodb.

use this

Very thanks, look great :smiley: