Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---Belli bir konuyu araştırmak istediğimizde aratmak istediğimiz tweet
- db.TwitterStatus.find({"searchID":ObjectId("546147f6177d9b2cb8c2cee6")})
- ----Kaç adet tweet atıldığını görmek için Kod:
- db.TwitterStatus.count({"searchID":ObjectId("546147f6177d9b2cb8c2cee6")})
- — Bir ID içinde bir kullanıcı hesabı kaç kere mention edilmiş bulmak için:
- db.TwitterStatus.aggregate(
- {$match: {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}},
- {$unwind:"$Status.EntitiesExt.UserMentionEntities"},
- {$group:{_id:"$Status.EntitiesExt.UserMentionEntities.ScreenName",count:{$sum:1}}},
- {$sort:{"count":-1}}
- )
- —— Birden fazla ID’li toplu atılan tweetlerin sayısını öğrenmek için
- db.TwitterStatus.count({
- $or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]})
- ——— Toplam kaç user tweet attı sorgu (Bu unique sonuç verir. Yani A kullanıcı 2 tweet atsa bile 1 diye geçer.)
- db.TwitterStatus.aggregate(
- {$match:{ $or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}]}},
- {$group:{_id:"$Status.User.UserIDResponse"}},
- {$group:{_id:1,count:{$sum:1}}})
- —— önce bunu kullan RT
- //Bu RT'li mesajları gruplar. Retweetlnmiş aynı mesajlar kendini tekrar etmez.
- //Sorguda okumanı kolaylaştırır (bunu öneririm)
- db.TwitterStatus.aggregate(
- {$match: {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}},
- {$group:
- {_id:"$Status.RetweetedStatus.StatusID",
- "Text": { $last : "$Status.Text"},
- "RetweetStatus": {$max : "$Status.RetweetedStatus.RetweetCount"}}},
- {$sort:{"RetweetStatus":-1}}
- )
- —— Tekil olarak en fazla RT almış mesaj sorgusu
- db.TwitterStatus.find({"searchID":ObjectId("546147f6177d9b2cb8c2cee6")})
- .sort({"Status.RetweetedStatus.RetweetCount":-1}).limit(100)
- ——— En fazla rt alan mesajlar
- db.TwitterStatus.find({
- $or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]})
- .sort({"Status.RetweetedStatus.RetweetCount":-1}).limit(100)
- ————— En fazla favorite alan mesaj
- db.TwitterStatus.find({
- $or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]}).limit(10)
- .sort({"Status.RetweetedStatus.FavoriteCount":-1})
- ———— En fazla Tweet almış hashtag
- db.TwitterStatus.aggregate(
- {$match: {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}},
- {$unwind:"$Status.EntitiesExt.HashTagEntities"},
- {$group:{_id:"$Status.EntitiesExt.HashTagEntities.Tag",count:{$sum:1}}},
- {$sort:{"count":-1}}
- )
- ————— Birden fazla ID’li çalışma için hashtag araması
- db.TwitterStatus.aggregate(
- {$match: {$or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]}},
- {$unwind:"$Status.EntitiesExt.HashTagEntities"},
- {$group:{_id:"$Status.EntitiesExt.HashTagEntities.Tag",count:{$sum:1}}},
- {$sort:{"count":-1}}
- )
- ———— 100 limitlii
- db.TwitterStatus.aggregate(
- {$match: {$or:
- [
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]}},
- {$unwind:"$Status.EntitiesExt.HashTagEntities"},
- {$group:{_id:"$Status.EntitiesExt.HashTagEntities.Tag",count:{$sum:1}}},
- {$sort:{"count":-1}},
- {$limit:100}
- )
- —— Keyword içinde bir ismin kaç kere geçtiği
- db.TwitterStatus.count({$and:[{"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},{"Status.Text": /Muslera/i }]})
- Mentionlanan ve bir ismin kaç kere geçtiğine bakmak için
- db.TwitterStatus.count({$and :[{"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {
- $or:[
- {"Status.Text": { $regex: /muslera/i } },
- {"Status.Text": { $regex: /1_Muslera_25/i } }
- ]
- }]})
- -Toplu Olarka Bakmak İstersek (Bunu Kullan )
- db.TwitterStatus.count({$and :[
- {
- $or:[
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")},
- {"searchID":ObjectId("546147f6177d9b2cb8c2cee6")}
- ]
- },
- {
- $or:[
- {"Status.Text": { $regex: /Gökhan Töre/i } },
- {"Status.Text": { $regex: /Gokhan Tore/i } },
- {"Status.Text": { $regex: /Töre/i } }
- ]
- }]})
Advertisement
Add Comment
Please, Sign In to add comment