Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6397a0f032
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 157 lines (136 sloc) 5.213 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
using System;
using System.Collections.Generic;

namespace MongoDB
{
    /// <summary>
    ///
    /// </summary>
    public interface IMongoDatabase
    {
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        string Name { get; }

        /// <summary>
        /// Gets the meta data.
        /// </summary>
        /// <value>The meta data.</value>
        DatabaseMetadata Metadata { get; }

        /// <summary>
        /// Gets the javascript.
        /// </summary>
        /// <value>The javascript.</value>
        DatabaseJavascript Javascript { get; }

        /// <summary>
        /// Gets the <see cref="MongoDB.IMongoCollection"/> with the specified name.
        /// </summary>
        /// <value></value>
        IMongoCollection this[string name] { get; }

        /// <summary>
        /// Gets the collection names.
        /// </summary>
        /// <returns></returns>
        List<String> GetCollectionNames();

        /// <summary>
        /// Gets the collection.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        IMongoCollection GetCollection(string name);

        /// <summary>
        /// Gets the collection.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        IMongoCollection<T> GetCollection<T>(string name) where T : class;

        /// <summary>
        /// Gets the collection.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        IMongoCollection<T> GetCollection<T>() where T : class;

        /// <summary>
        /// Gets the document that a reference is pointing to.
        /// </summary>
        /// <param name="reference">The reference.</param>
        /// <returns></returns>
        Document FollowReference(DBRef reference);

        /// <summary>
        /// Follows the reference.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="reference">The reference.</param>
        /// <returns></returns>
        T FollowReference<T>(DBRef reference) where T:class;

        /// <summary>
        /// Most operations do not have a return code in order to save the client from having to wait for results.
        /// GetLastError can be called to retrieve the return code if clients want one.
        /// </summary>
        /// <returns></returns>
        Document GetLastError();

        /// <summary>
        /// Retrieves the last error and forces the database to fsync all files before returning.
        /// </summary>
        /// <param name="fsync">if set to <c>true</c> [fsync].</param>
        /// <returns></returns>
        /// <remarks>
        /// Server version 1.3+
        /// </remarks>
        Document GetLastError(bool fsync);

        /// <summary>
        /// Call after sending a bulk operation to the database.
        /// </summary>
        /// <returns></returns>
        Document GetPreviousError();

        /// <summary>
        /// Gets the sister database on the same Mongo connection with the given name.
        /// </summary>
        /// <param name="sisterDatabaseName">Name of the sister database.</param>
        /// <returns></returns>
        MongoDatabase GetSisterDatabase(string sisterDatabaseName);

        /// <summary>
        /// Resets last error. This is good to call before a bulk operation.
        /// </summary>
        void ResetError();

        /// <summary>
        /// Evals the specified javascript.
        /// </summary>
        /// <param name="javascript">The javascript.</param>
        /// <returns></returns>
        Document Eval(string javascript);

        /// <summary>
        /// Evals the specified javascript.
        /// </summary>
        /// <param name="javascript">The javascript.</param>
        /// <param name="scope">The scope.</param>
        /// <returns></returns>
        Document Eval(string javascript, Document scope);

        /// <summary>
        /// Evals the specified code scope.
        /// </summary>
        /// <param name="codeScope">The code scope.</param>
        /// <returns></returns>
        Document Eval(CodeWScope codeScope);

        /// <summary>
        /// Sends the command.
        /// </summary>
        /// <param name="commandName">The command name.</param>
        /// <returns></returns>
        Document SendCommand(string commandName);

        /// <summary>
        /// Sends the command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        Document SendCommand(Document command);

        /// <summary>
        /// Sends the command.
        /// </summary>
        /// <param name="rootType">Type of serialization root.</param>
        /// <param name="command">The CMD.</param>
        /// <returns></returns>
        Document SendCommand(Type rootType, Document command);
    }
}
Something went wrong with that request. Please try again.