package com.tengen;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.mongodb.AggregationOutput;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;
public class Homework23 {
public static void main(String[] args) throws UnknownHostException {
MongoClient client = new MongoClient(new ServerAddress("localhost",
27017));
DB db = client.getDB("students");
DBCollection collection = db.getCollection("grades");
BasicDBObject bdb = new BasicDBObject("type", "homework");
BasicDBObject sort = new BasicDBObject("student_id", 1).append("score",
1);
// DBCursor cur = collection.find(bdb).sort(sort);
List<DBObject> pipeline = new ArrayList<DBObject>();
pipeline.add(new BasicDBObject("$group", new BasicDBObject("_id",
"$student_id")));
AggregationOutput aoup = collection.aggregate(pipeline);
Iterable<DBObject> results = aoup.results();
Iterator<DBObject> itr = results.iterator();
DBCursor cur = null;
try {
while (itr.hasNext()) {
DBObject agdb = itr.next();
bdb.append("student_id", agdb.get("_id"));
cur = collection.find(bdb).sort(sort);
cur.hasNext();
DBObject docToRemove = cur.next();
Double minScore = (Double) docToRemove.get("score");
while (cur.hasNext()) {
DBObject doc1 = cur.next();
if (minScore > (Double) doc1.get("score")) {
minScore = (Double) doc1.get("score");
docToRemove = doc1;
}
}
System.out.println("*********************");
System.out.println(docToRemove);
System.out.println("*********************");
collection.remove(docToRemove);
}
}
finally {
if (cur != null)
cur.close();
}
}
}
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.mongodb.AggregationOutput;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;
public class Homework23 {
public static void main(String[] args) throws UnknownHostException {
MongoClient client = new MongoClient(new ServerAddress("localhost",
27017));
DB db = client.getDB("students");
DBCollection collection = db.getCollection("grades");
BasicDBObject bdb = new BasicDBObject("type", "homework");
BasicDBObject sort = new BasicDBObject("student_id", 1).append("score",
1);
// DBCursor cur = collection.find(bdb).sort(sort);
List<DBObject> pipeline = new ArrayList<DBObject>();
pipeline.add(new BasicDBObject("$group", new BasicDBObject("_id",
"$student_id")));
AggregationOutput aoup = collection.aggregate(pipeline);
Iterable<DBObject> results = aoup.results();
Iterator<DBObject> itr = results.iterator();
DBCursor cur = null;
try {
while (itr.hasNext()) {
DBObject agdb = itr.next();
bdb.append("student_id", agdb.get("_id"));
cur = collection.find(bdb).sort(sort);
cur.hasNext();
DBObject docToRemove = cur.next();
Double minScore = (Double) docToRemove.get("score");
while (cur.hasNext()) {
DBObject doc1 = cur.next();
if (minScore > (Double) doc1.get("score")) {
minScore = (Double) doc1.get("score");
docToRemove = doc1;
}
}
System.out.println("*********************");
System.out.println(docToRemove);
System.out.println("*********************");
collection.remove(docToRemove);
}
}
finally {
if (cur != null)
cur.close();
}
}
}
db.eval( function(name, amount) {
ReplyDeletevar index;
db.grades.aggregate([{$sort:{"student_id":1, "score":1}}, {$out:"authors"}])
for(index=0; index<200 ;index++)
{
db.authors.remove({"student_id":index, "type": "homework"},1)
}
},
"Cross", 5);
https://bayanlarsitesi.com/
ReplyDeleteEskişehir
Erzincan
Ardahan
Erzurum
LKFY
Malatya
ReplyDeleteKırıkkale
Aksaray
Bitlis
Manisa
GYQO30
whatsapp görüntülü show
ReplyDeleteücretli.show
RNHF
tunceli evden eve nakliyat
ReplyDeletekarabük evden eve nakliyat
konya evden eve nakliyat
urfa evden eve nakliyat
çorum evden eve nakliyat
V8EJAU
çankırı evden eve nakliyat
ReplyDeletekırşehir evden eve nakliyat
kütahya evden eve nakliyat
hakkari evden eve nakliyat
antalya evden eve nakliyat
AJ0İ
6C600
ReplyDeleteÇankırı Parça Eşya Taşıma
Bartın Lojistik
Yalova Parça Eşya Taşıma
Van Parça Eşya Taşıma
Samsun Lojistik
B7BAB
ReplyDeleteÇerkezköy Petek Temizleme
Bolu Şehir İçi Nakliyat
Uşak Parça Eşya Taşıma
Malatya Lojistik
Bartın Evden Eve Nakliyat
Muğla Parça Eşya Taşıma
Konya Parça Eşya Taşıma
Düzce Parça Eşya Taşıma
Silivri Cam Balkon
D1B93
ReplyDeletehttps://referanskodunedir.com.tr/
6154B
ReplyDeleteCeek Coin Hangi Borsada
Pepecoin Coin Hangi Borsada
Btcturk Borsası Güvenilir mi
Btcturk Borsası Güvenilir mi
Aptos Coin Hangi Borsada
Sonm Coin Hangi Borsada
Alya Coin Hangi Borsada
Tiktok Beğeni Satın Al
Tumblr Beğeni Hilesi
E04AD
ReplyDeleteCoin Nedir
Ergo Coin Hangi Borsada
Sweat Coin Hangi Borsada
Dlive Takipçi Satın Al
Pitbull Coin Hangi Borsada
Sui Coin Hangi Borsada
Onlyfans Takipçi Hilesi
Mith Coin Hangi Borsada
Twitter Retweet Hilesi