[SERVER-38126] Unable to drop a collection with "@" in name Created: 14/Nov/18  Updated: 30/Nov/18  Resolved: 30/Nov/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Suresh L. Prajapati Assignee: Danny Hatcher (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: Linux
Participants:

 Description   

I am trying to drop some collections, but It's not working. Below are the commands:
<
rs-ds4564584:PRIMARY> show collections
^12345'"\'\");|]*%00{%0d%0a<%00>%bf%27'ðŸ'©_undefined_omcandle^
sqlmongomigration-temp-collection-12345
to@example.com>
bcc:052608.8_64.8.a364e.1@bxss.me_omcandle
to@example.com>
bcc:052608.8_68.8.a364e.1@bxss.me_omcandle
to@example.com>
bcc:052608.8_70.8.a364e.1@bxss.me_omcandle
to@example.com>
bcc:052608.8_72.8.a364e.1@bxss.me_omcandle

I am trying to remove all collections having "@" in thier name, but on executing drop() command it is returning false.

rs-ds4564584:PRIMARY> db['to@example.com>'].drop()
false

Please help me on how I can delete all such collections.



 Comments   
Comment by Danny Hatcher (Inactive) [ 15/Nov/18 ]

Hello Suresh,

Per our documentation, if your collection contains special characters such as @ then you would use the use the db.getCollection() method in the mongo shell.

The following drops the "asd@test.com" collection:

db.getCollection('asd@test.com').drop() 

Thank you,

Danny

Generated at Thu Feb 08 04:48:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.