Exemplo n.º 1
0
        // get index on a given collection
        public static BsonDocument GetIndex(DBCollection dbc, string indexName)
        {
            DBCursor cursor = null;
            try
            {
                cursor = dbc.GetIndex(indexName);
            }
            catch (BaseException e)
            {
                Console.WriteLine("Failed to get index {0} from collection, ErrorType = {1}", indexName, e.ErrorType);
                Environment.Exit(0);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Environment.Exit(0);
            }

            return cursor.Next();
        }