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
//content dokümanındaki tüm 'url' fiedlarının adını link olarak değiştiriyoruz. | |
db.content.update({},{$rename:{'url':'link'}},false,true) |
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
//aşağıdaki şekilde author küçükten büyüğe indexlenir. | |
db.content.createIndex("author":1) | |
//aşağıdaki şekilde ise author büyükten küçüğe indexlenir. | |
db.content.createIndex("author":-1) |
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
//Bu şekilde kullanıldığında sonuç görüntüsü kolay okunabilir bir format halini geliyor. | |
db.collection.find(<koşul>).pretty() |
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
//bu query likes sayısı 5 eşit olan dökümanları getirir. | |
db.collection.find({likes:5}) | |
//Sonuç | |
{ | |
_id:ObjectId("507f191e810c19729de860ea"), | |
title: 'MongoDB Insert', | |
description: 'MongoDB Kayıt ekleme', | |
author: 'Engin Kartal', | |
url: 'http://www.enginkartal.com.tr', |
NewerOlder