Quantcast
Viewing all articles
Browse latest Browse all 120

Aggregation & Indexing With Suitable Example Using MongoDB.

============ Aggregation & JAVA Program In MongoDB ============

import java.net.UnknownHostException;
import java.util.regex.Pattern;
import com.mongodb.*;

public class ManagePeople {
   
    public static void main(String[] args) {
        try {
            Mongo m = new Mongo("localhost", 27017);
            DB db = m.getDB("sampledb");
            DBCollection coll = db.getCollection("people");
            DBCursor cur = coll.find();
            while (cur.hasNext())
            coll.remove(cur.next());
            coll.ensureIndex(new BasicDBObject("id",


Read more »

Viewing all articles
Browse latest Browse all 120

Trending Articles