public static void FindRecord(DBCollection dbc, BsonDocument query, BsonDocument selector, BsonDocument orderBy, BsonDocument hint, long skip, long numReturn) { try { // find specific records from collection with rules DBCursor cursor = dbc.Query(query, selector, orderBy, hint, skip, numReturn); Console.WriteLine("Record read:"); while ( cursor.Next() != null ) Console.WriteLine(cursor.Current().ToString()); } catch (BaseException e) { Console.WriteLine("Failed to find records from collection, ErrorType = {0}", e.ErrorType); return; } catch (Exception e) { Console.WriteLine(e.Message); Environment.Exit(0); } }
public static void FindRecord(DBCollection dbc, DBQuery query) { try { // find specific records from collection with DBQuery DBCursor cursor = dbc.Query(query); Console.WriteLine("Record read:"); while ( cursor.Next() != null ) Console.WriteLine(cursor.Current().ToString()); } catch (BaseException e) { Console.WriteLine("Failed to find records from collection, ErrorType = {0}", e.ErrorType); return; } catch (Exception e) { Console.WriteLine(e.Message); Environment.Exit(0); } }