using (var cursor = collection.Find(new BsonDocument()).ToCursor()) { while (cursor.MoveNext()) { foreach (var document in cursor.Current) { var reader = new BsonReader(document.ToBson()); reader.ReadStartDocument(); var id = reader.ReadObjectId("_id"); reader.ReadEndDocument(); // Do something with the ObjectId value... } } }This code reads all documents from a MongoDB collection and then reads and processes the "_id" field, which is assumed to be an ObjectId. The package library for the MongoDB C# driver is "MongoDB.Driver".