Hi Kevin,
MongoDB should display the number of removed documents. At least in versions: v2.6.11, v3.0.9, and v3.2.3.
Make sure that you execute remove() in the right database i.e. the database that contains the collection you intend to remove.
If you execute remove() in a collection that does not exist it would return nRemoved: 0
For example:
> db.collection_doesnt_exist.remove({})
WriteResult({ "nRemoved" : 0 })
If you are still having this issue, could you provide the following:
remove().Regards,
Wan.
Hi Kevin,
To remove a collection from a database you could use db.collection.drop(). It also removes any indexes associated with the dropped collection.
For reference of all the available collection methods please see Collection Methods.
I would recommend to enrol in a free online course MongoDB University: M102 - MongoDB for DBAs to find out more about MongoDB. The next session starts on 15th March.
Kind regards,
Wan.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/mlbf-t2Q5tg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/adabc67e-820d-4137-bcf5-13c1b7efa61c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Kevin,
As mentioned in the manual for db.collection.drop(), the command returns false when the collection to drop does not exist.
Note that the word collection in db.collection.drop() is meant to be replaced with your own collection name. So per your example, it’s should be db.formDefinition.drop().
So, the command is actually db.<your collection name>.drop().
Also make sure that you executed db.collection.drop() in the correct database. Check using show collections whether the collection that you are wanting to drop exist in the database you are on. Please see command helpers to see commands such as use <db> or show dbs.
Additionally, please check out the tutorial working with the Mongo Shell
Regards,
Wan.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/mlbf-t2Q5tg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/9761f04b-58b8-4bf7-af81-22818224a0bc%40googlegroups.com.