The collection created by mongodb cannot be deleted, nor can it get the data in the collection. Ask for help.

I created a collection (category), in MongoDB Community and added some test data to it. When I called the database query, I found that there was no data query. At first, I thought I had written the name of the collection wrong, but it turned out that it was not.

when I looked up the collection name of the database with the command line, I found that there was such a collection

clipboard.png

clipboard.png

clipboard.png

categorycategory

clipboard.png

then when you query again, you only find the contents of the new collection.

finally, when I tried to delete both collections, I found that the old category collection could not be deleted.

these are some of the basics of the question, so the last thing I want to ask is

Why is it that the collection I created in MongoDB Community can"t get the data and can"t delete it?

Mar.29,2021

or try to restart the mongo service


what version of MongoDB? is the first?
generally this kind of problem comes from the use of different encodings in the collection name or the presence of special characters that cannot be displayed.
first take a look at the execution result of this: db.getCollectionNames () , which will return an array to count where your collection appears (notice that the array subscript starts at 0).
then try: db [db.getCollectionNames () [n]] .drop (); , where n is the position you just counted.

Menu