[JAVA-1341] DBCollection drop method does not delete a collection Created: 02/Aug/14 Updated: 04/Aug/14 Resolved: 03/Aug/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | deepak vohra | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7 |
||
| Description |
|
The drop() method in DBCollection does not delete a collection. |
| Comments |
| Comment by deepak vohra [ 04/Aug/14 ] | |||||
|
But the collection has been dropped. In the following catalog is the document to add to coll. | |||||
| Comment by Jeffrey Yemin [ 04/Aug/14 ] | |||||
|
It determines it by its name. | |||||
| Comment by deepak vohra [ 03/Aug/14 ] | |||||
|
Must be some reference to the deleted collection kept in the cache or how else is it determined which collection is being referenced? For example if a collection has been created in another application. coll = db.createCollection("catalog", null); And in a different application the collection is dropped. And in the second application the collection is referenced after being dropped. How is determined which collection is being referred to? Or, is a reference kept to the dropped collection? | |||||
| Comment by Jeffrey Yemin [ 03/Aug/14 ] | |||||
|
Oh, I see the confusion. See http://docs.mongodb.org/manual/reference/method/db.createCollection/#db.createCollection. It states that collections in MongoDB are created implicitly whenever you reference them. So in step 4, the collection is created again after you drop it in step 3. | |||||
| Comment by deepak vohra [ 03/Aug/14 ] | |||||
|
Haven't tested with shell but in a Java application the collection is still available and only the documents get deleted. To test: 1. Create a collection. | |||||
| Comment by Jeffrey Yemin [ 03/Aug/14 ] | |||||
|
Please re-open if you can demonstrate that the collection is not actually dropped. | |||||
| Comment by Jeffrey Yemin [ 02/Aug/14 ] | |||||
|
I just tried it. Here's the shell output from before calling drop on collection named foo:
and here it is from after:
What do you see that makes you think it's not? | |||||
| Comment by deepak vohra [ 02/Aug/14 ] | |||||
|
The drop() method just deletes the documents in the collection but does not delete the collection. Shouldn't the drop() method delete the collection? |