Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- Mongo mongo = new Mongo();
- mongo.Connect();
- Database db = mongo["testdb"];
- Random rand = new Random();
- IMongoCollection docs = db.GetCollection("docs");
- //for (int i = 0; i < 100; ++i)
- //{
- // Document doc = new Document();
- // StringBuilder sb = new StringBuilder();
- // doc["title"] = Guid.NewGuid().ToString();
- // doc["author"] = rand.Next() % 10;
- // docs.Insert(doc);
- //}
- Document doc = new Document();
- doc["author"] = 1;
- foreach (Document hit in docs.Find(doc).Documents)
- {
- Console.WriteLine("{0} {1} {2}", hit["author"], hit["name"], hit["title"]);
- }
- Console.ReadLine();
- }
- }
Add Comment
Please, Sign In to add comment