MongoDB.Driver.Database.SendCommand C# (CSharp) Метод

SendCommand() публичный Метод

public SendCommand ( Document cmd ) : Document
cmd Document
Результат Document
        public Document SendCommand(Document cmd)
        {
            Document result = this.command.FindOne(cmd);
            double ok = (double)result["ok"];
            if (ok != 1.0){
                string msg;
                if(result.Contains("msg")){
                    msg = (string)result["msg"];
                }else{
                    msg = string.Empty;
                }
                throw new MongoCommandException(msg,result,cmd);
            }
            return result;
        }

Same methods

Database::SendCommand ( string command ) : Document

Usage Example

        public Collection CreateCollection(String name, Document options)
        {
            Document cmd = new Document();

            cmd.Append("create", name).Update(options);
            db.SendCommand(cmd);
            return(new Collection(name, connection, this.name));
        }
All Usage Examples Of MongoDB.Driver.Database::SendCommand