[SERVER-83882] I can't drop a view with two consecutives dots in the name Created: 05/Dec/23  Updated: 01/Jan/24

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

Type: Bug Priority: Major - P3
Reporter: Vincent Perez Assignee: Backlog - Triage Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Operating System: ALL
Steps To Reproduce:

You can easily create a view or a collection with a double dot in the name, then it's impossible to delete it.

Participants:

 Description   

I've accidentally named a view : "test...view". When I try to delete it now I get the following error : MongoInvalidArgumentError: Collection names cannot be empty

I tried running the following command : db.getCollection("test..view").drop()

I also tried to rename it but got the same error.

But the error is still there.



 Comments   
Comment by Eric Sedor [ 13/Dec/23 ]

Interesting vincentperez91@gmail.com. Can you provide version details about the module you're referring to? I may be able to transfer this ticket to a different project

Comment by Vincent Perez [ 13/Dec/23 ]

I'm really sorry I finally succeeded to remove the collection. The issue is coming from the mongo node module. There is a line of code that looks for '..' string in the collection name and return the error of an empty collection name. I thought that it was coming from the database itself but it's not the case.
Nevertheless, it's a weird behavior.

Comment by Eric Sedor [ 13/Dec/23 ]

vincentperez91@gmail.com I am not readily able to reproduce this via the following:

replset:PRIMARY> db.version() 6.0.12 
replset:PRIMARY> db.createView("test..view","test",[])
{
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1702484414, 2),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    },
    "operationTime" : Timestamp(1702484414, 2)
}
replset:PRIMARY> show collections
system.views
test
test..viewreplset:PRIMARY> db.getCollection("test..view").drop()
true
replset:PRIMARY> show collections
system.views
test 

Can you please take a look and see if you can provide more details that will help?

Sincerely,

Eric

Generated at Thu Feb 08 06:53:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.