zoukankan      html  css  js  c++  java
  • C# mongodb驱动 执行脚本

    command命令语法:

    https://docs.mongodb.com/manual/reference/command/find/#dbcmd.find

    db.runCommand(
       {
         find: "restaurants",
         filter: { rating: { $gte: 9 }, cuisine: "italian" },
         projection: { name: 1, rating: 1, address: 1 },
         sort: { name: 1 },
         limit: 5
       }
    )
    

      

    var bsonDoc = BsonDocument.Parse("{"find":"producer"}");
    var cmd = new BsonDocumentCommand<FindCommandResult<Person>>(bsonDoc);
    
    var result = db.RunCommand<FindCommandResult<Person>>(cmd);
    

      

     [BsonIgnoreExtraElements]
        public class FindCommandResult<T>
        {
            public Double ok { get; set; }
    
            [BsonElement("cursor")]
            public ResultCursor<T> cursor { get; set; }
        }
    
        [BsonIgnoreExtraElements]
        public class ResultCursor<T>
        {
            public long id { get; set; }
    
            public String ns { get; set; }
    
            [BsonElement("firstBatch")]
            public T[] firstBatch { get; set; }
    
        }
    

      

  • 相关阅读:
    (转载)MySQL日期时间函数大全
    Tcl commands
    Toplevel
    tk 8.4 commands
    iwidgets
    Options for Buttontype widgets
    Text Widget Options
    tk options
    itk_option
    Widget Options
  • 原文地址:https://www.cnblogs.com/huawublog/p/14102833.html
Copyright © 2011-2022 走看看