mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update mongodb
This commit is contained in:
@@ -119,6 +119,7 @@ namespace MongoDbTest
|
||||
|
||||
private static void DataTableTest()
|
||||
{
|
||||
//datatable
|
||||
{
|
||||
var connection = new MongoDbConnection(DbHelper.SqlSugarConnectionString);
|
||||
connection.Open();
|
||||
@@ -130,6 +131,18 @@ namespace MongoDbTest
|
||||
mongoDbDataAdapter.Fill(dt);
|
||||
connection.Close();
|
||||
}
|
||||
//dataset
|
||||
{
|
||||
var connection = new MongoDbConnection(DbHelper.SqlSugarConnectionString);
|
||||
connection.Open();
|
||||
////SELECT * FROM b ORDER BY age DESC OFFSET 1 ROWS FETCH NEXT 2 ROWS ONLY;
|
||||
MongoDbCommand mongoDbCommand = new MongoDbCommand(" aggregate b [\r\n { \"$sort\": { \"age\": -1 } },\r\n { \"$skip\": 1 },\r\n { \"$limit\": 2 }\r\n] ]", connection);
|
||||
MongoDbDataAdapter mongoDbDataAdapter = new MongoDbDataAdapter();
|
||||
mongoDbDataAdapter.SelectCommand = mongoDbCommand;
|
||||
DataSet ds = new DataSet();
|
||||
mongoDbDataAdapter.Fill(ds);
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
private static void ExecuteScalarTest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user