MongoDB runs queries in the same way as SQL!

    public IQueryable<T> GetRecords<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression, int from, int first) where T : class, new()
    {
        first = first == 0 ? 30 : first;
        return _db.GetCollection<T>(collectionName).Linq().Where(expression).Skip(from).Take(first);
    }
    var x = GetRecords<Event>(p => true, 0, 12222);
    string eventJson = new JavaScriptSerializer().Serialize(x);

this function gets data from mongoDB.

    SqlDataReader dr = SqlHelper.ExecuteReader("Select Top(12222)* From NewsFeed");
    string eventJson = new JavaScriptSerializer().Serialize(dr);

and this is from SQL Server.

I tried to measure the runtime for each of them, and the result was as follows: Mongo: 172ms
SQL: 185 ms.
but since I know mongoDB should be too fast than SQL, right!?!

+2
source share
1 answer

MongoDB SQL ; , . , , . SQL- , , .. , , , ( ). NoSQL , "". .

, NoSQL .

+7

Source: https://habr.com/ru/post/1787432/


All Articles