Created
December 27, 2015 17:01
-
-
Save enginkartal/ed981878996fdd8344c9 to your computer and use it in GitHub Desktop.
MongoDB Remove
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Author: Engin Kartal | |
//Blog Post: http://enginkartal.com.tr/mongodb-remove/ | |
db.collection.remove( | |
<query>, | |
{ | |
justOne: <boolean>, | |
writeConcern: <document> | |
} | |
) | |
//Tüm dokümanları sil | |
db.content.remove({}); | |
//Bir koşula uyan dokümanları sil | |
//Aşağıdaki sorgu likes sayısı 7 olan tüm dokümanları siler. | |
db.content.remove({likes:7}) | |
//Bir koşula uyan dokümanlardan tek kaydı sil | |
//Aşağıdaki sorgu likes sayısı 7 olan dokümanlardan sadece 1 tanesini siler. | |
db.content.remove({likes:7},1) | |
//ya da | |
db.content.remove({likes:7},true) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment