<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:56 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-822] driver v1.8.2 driver query slow</title>
                <link>https://jira.mongodb.org/browse/CSHARP-822</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Realize the same function of the code. like this(run environment: cpu:E5300,Memory:4GB ,win2008R2 x64):&lt;/p&gt;

&lt;p&gt; class Program&lt;br/&gt;
    {&lt;br/&gt;
        static void Main(string[] args)&lt;/p&gt;
        {
            UseMongoDbDriver1_5_0_Test();
            UseMongoDbDriver1_8_2_Test();
            Console.Read();
             
        }

&lt;p&gt;        static void UseMongoDbDriver1_8_2_Test()&lt;br/&gt;
        {&lt;br/&gt;
            var client = new MongoClient();&lt;br/&gt;
            var server = client.GetServer();&lt;br/&gt;
            Stopwatch st = new Stopwatch();&lt;br/&gt;
            st.Start();&lt;br/&gt;
            var result = server.GetDatabase(&quot;Test&quot;).GetCollection(&quot;Product&quot;).FindAll().SetLimit(10).ToList();&lt;br/&gt;
            st.Stop();&lt;br/&gt;
            Console.WriteLine(&quot;Driver v1.8.2 QueryResult ToList ElapsedTime: &lt;/p&gt;
{0} ms&quot;, st.ElapsedMilliseconds);&lt;br/&gt;
            //output: Driver v1.5.0 QueryResult ToList ElapsedTime: 1445 ms&lt;br/&gt;
        }&lt;br/&gt;
&lt;br/&gt;
        static void UseMongoDbDriver1_5_0_Test()&lt;br/&gt;
        {&lt;br/&gt;
            MongoServer server = MongoServer.Create(&quot;mongodb://127.0.0.1:27017/Test&quot;);&lt;br/&gt;
            MongoDatabase db = MongoDatabase.Create(&quot;mongodb://127.0.0.1:27017/Test&quot;);&lt;br/&gt;
            using (server.RequestStart(db))&lt;br/&gt;
            {&lt;br/&gt;
                Stopwatch st = new Stopwatch();&lt;br/&gt;
                var result = db.GetCollection(&quot;Product&quot;).FindAll().SetLimit(10).ToList();&lt;br/&gt;
                st.Stop();&lt;br/&gt;
                Console.WriteLine(&quot;Driver v1.5.0 Query Result ToList ElapsedTime: {0}
&lt;p&gt; ms&quot;, st.ElapsedMilliseconds);&lt;br/&gt;
            }&lt;br/&gt;
            //output: Driver v1.5.0 QueryResult ToList ElapsedTime: 0 ms&lt;br/&gt;
        }&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;that maybe a bug. driver v1.5.0 query result faster than v1.8.2 ?&lt;/p&gt;</description>
                <environment></environment>
        <key id="89899">CSHARP-822</key>
            <summary>driver v1.8.2 driver query slow</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="cow.virus">CowVirus</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Sat, 14 Sep 2013 03:12:03 +0000</created>
                <updated>Tue, 25 Aug 2015 14:18:03 +0000</updated>
                            <resolved>Mon, 23 Sep 2013 17:43:54 +0000</resolved>
                                    <version>1.8.2</version>
                                    <fixVersion>1.8.3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1013848" author="xgen-internal-githook" created="Tue, 25 Aug 2015 14:18:03 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-822&quot; title=&quot;driver v1.8.2 driver query slow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-822&quot;&gt;&lt;del&gt;CSHARP-822&lt;/del&gt;&lt;/a&gt;: added in check to not fetch the next batch when it is not required.&lt;br/&gt;
Branch: v1.8.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/82e6c70fca0db4b733c41ae05bdab511deeb25e8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/82e6c70fca0db4b733c41ae05bdab511deeb25e8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="429866" author="craiggwilson" created="Mon, 23 Sep 2013 17:45:13 +0000"  >&lt;p&gt;This has also already been fixed on master due to some refactoring in the master branch.&lt;/p&gt;</comment>
                            <comment id="428398" author="auto" created="Thu, 19 Sep 2013 14:39:33 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-822&quot; title=&quot;driver v1.8.2 driver query slow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-822&quot;&gt;&lt;del&gt;CSHARP-822&lt;/del&gt;&lt;/a&gt;: added in check to not fetch the next batch when it is not required.&lt;br/&gt;
Branch: v1.8.3&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/82e6c70fca0db4b733c41ae05bdab511deeb25e8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/82e6c70fca0db4b733c41ae05bdab511deeb25e8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="428357" author="craiggwilson" created="Thu, 19 Sep 2013 13:31:03 +0000"  >&lt;p&gt;@CowVirus,&lt;/p&gt;

&lt;p&gt;  Thanks for the report.  We have reproduced this result and have identified the problem.  We&apos;ll be issuing a point release very soon to fix this.  In the meantime, when you want to set a limit, you can use a negative number.  For instance, FindAll().SetLimit(-10).ToList() will work correctly.  Please keep an eye on this ticket for the fix which should come today and a 1.8.3 release to nuget and github.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="427587" author="cow.virus" created="Wed, 18 Sep 2013 02:30:45 +0000"  >&lt;p&gt;TestCase:&lt;/p&gt;

&lt;p&gt;databaseName : Test  chanage to test&lt;/p&gt;</comment>
                            <comment id="427580" author="cow.virus" created="Wed, 18 Sep 2013 02:14:59 +0000"  >&lt;p&gt;1. example document :&lt;br/&gt;
========================================================================&lt;br/&gt;
    class TestCollection&lt;br/&gt;
    {&lt;br/&gt;
        public int Id &lt;/p&gt;
{ get; set; }&lt;br/&gt;
&lt;br/&gt;
        public string Name { get; set; }
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    class Program&lt;br/&gt;
    {&lt;br/&gt;
        static void Main(string[] args)&lt;/p&gt;
        {
            InsertTestCollections();
            Console.Read();
        }

&lt;p&gt;        static void InsertTestCollections()&lt;br/&gt;
        {&lt;br/&gt;
            IList&amp;lt;TestCollection&amp;gt; cols = new List&amp;lt;TestCollection&amp;gt;();&lt;br/&gt;
            for (int i = 0; i &amp;lt; 200001; i++)&lt;br/&gt;
            {&lt;br/&gt;
                cols.Add(new TestCollection()&lt;br/&gt;
                &lt;/p&gt;
{
                    Id = i + 1,
                    Name = Guid.NewGuid().ToString(&quot;N&quot;)
                }
&lt;p&gt;);&lt;br/&gt;
                if (cols.Count == 10000)&lt;/p&gt;
                {
                    Inserts(cols);
                    cols.Clear();
                }
&lt;p&gt;            }&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;        static void Inserts(IList&amp;lt;TestCollection&amp;gt; items)&lt;br/&gt;
        {&lt;br/&gt;
            var client = new MongoClient();&lt;br/&gt;
            var server = client.GetServer();&lt;br/&gt;
            var db = server.GetDatabase(&quot;test&quot;);&lt;br/&gt;
            var result = db.GetCollection&amp;lt;TestCollection&amp;gt;(&quot;TestCollection&quot;).InsertBatch(items);&lt;br/&gt;
            Console.WriteLine(&quot;insert TestCollection count:&lt;/p&gt;
{0}
&lt;p&gt;&quot;, result.Sum(s =&amp;gt; s.Ok ? 1 : 0));&lt;br/&gt;
        }&lt;br/&gt;
    }&lt;br/&gt;
========================================================================&lt;/p&gt;

&lt;p&gt;2. my mongod is run on local&lt;/p&gt;

&lt;p&gt;3. my mongodb setup ini:&lt;br/&gt;
=======================================================================&lt;br/&gt;
##dbPath&lt;br/&gt;
dbpath = D:\Develop\NoSql\MongoDb\v2.x\bin\Data&lt;br/&gt;
directoryperdb = true&lt;br/&gt;
port = 27017&lt;br/&gt;
master =true&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;
	&lt;ol&gt;
		&lt;li&gt;logPath&lt;br/&gt;
logpath =D:\Develop\NoSql\MongoDb\v2.x\bin\Logs\MongoDb.log&lt;br/&gt;
logappend = true&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;
	&lt;ol&gt;
		&lt;li&gt;Service Config&lt;br/&gt;
serviceName=MongoDb-v2.x&lt;br/&gt;
serviceDisplayName= MongoDb-v2.x &lt;br/&gt;
serviceDescription = Mongodb LocalService&lt;br/&gt;
=======================================================================&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;somebody say , The cause of the issue because of  &quot;Serializer &quot;.&lt;br/&gt;
you can test  more machine for the testcase, i tested many times the all result is slowly by driverv1.8.2.&lt;br/&gt;
thanks.&lt;/p&gt;</comment>
                            <comment id="427030" author="craiggwilson" created="Tue, 17 Sep 2013 13:19:32 +0000"  >&lt;p&gt;When I run these on my local machine, I get 0ms for every single one of them.  However, I don&apos;t know what data you are fetching (so I made up my own). So I have a couple further questions:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Could you provide an example document that is stored in your database?&lt;/li&gt;
	&lt;li&gt;Are you running mongod locally or on a different machine?&lt;/li&gt;
	&lt;li&gt;What is your setup?  Replica set, stand alone machine, sharded?&lt;/li&gt;
&lt;/ol&gt;
</comment>
                            <comment id="426990" author="cow.virus" created="Tue, 17 Sep 2013 08:20:54 +0000"  >&lt;p&gt;hi,all.&lt;br/&gt;
I test the mongodb driver version :v1.5.0, v1.7.1,v1.8.2&lt;br/&gt;
 on my machine  the same code  query result for the   execution time(avg) result :&lt;br/&gt;
v1.5 : 2.39 ms&lt;br/&gt;
v1.7.1: 2.98 ms&lt;br/&gt;
v1.8.2 : 677.92 ms(slowly)&lt;/p&gt;

&lt;p&gt;please download my attach files ,open my solution &apos;s three project and test.&lt;br/&gt;
maybe that is really a performance issue for the driverv1.8.2&lt;br/&gt;
thanks.&lt;/p&gt;</comment>
                            <comment id="426976" author="cow.virus" created="Tue, 17 Sep 2013 07:06:13 +0000"  >&lt;p&gt;Thanks for your reply!&lt;br/&gt;
I&apos;m sorry to my code that is incorrect ...and my apologize for the inconvenience this error may have caused you.&lt;br/&gt;
for the code is  some pseudo code .&lt;br/&gt;
I&apos;ll check my TestCase and reconfirm this issue . &lt;/p&gt;</comment>
                            <comment id="425191" author="craiggwilson" created="Sat, 14 Sep 2013 18:44:02 +0000"  >&lt;p&gt;In addition to not calling start in your 1_5_0 test method, you also aren&apos;t using the same code.  In 1_5_0, you have a server.RequestStart(db) call which doesn&apos;t exist in your 1_8_2 test. If you want accurate, apples to apples comparisons, you need to be doing the exact same thing.&lt;/p&gt;</comment>
                            <comment id="424999" author="rstam" created="Sat, 14 Sep 2013 03:53:00 +0000"  >&lt;p&gt;I don&apos;t see a call to st.Start() in your UseMongoDbDriver1_5_0_Test method... maybe that explains why it appears to take 0ms?&lt;/p&gt;

&lt;p&gt;It&apos;s also not clear to me how you can use two different versions of the driver in the same program.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="31514" name="Test.MongoDbDriver.zip" size="4296755" author="cow.virus" created="Wed, 18 Sep 2013 02:30:45 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrsvxr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>82418</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>