<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:14:51 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>[SERVER-7549] document level stats</title>
                <link>https://jira.mongodb.org/browse/SERVER-7549</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Implement stats similar to those found on the db and col levels.&lt;/p&gt;

&lt;p&gt;Currently there is no efficient way of obtaining stats such as the size of a document without sending the document down the wire to the client and bson encoding the document.&lt;/p&gt;

&lt;p&gt;Suggest storing document stats as meta data beside each document in a collection but only return such stats data when requested as shown in the following examples.&lt;/p&gt;

&lt;p&gt;Return a summary (aggregation of stats):&lt;/p&gt;

&lt;p&gt;db.col.findOne({}).stats();&lt;br/&gt;
db.col.find({}).stats();&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;would return a document similar to db.stats() and col.stats() and contain an aggregation of all documents in the server cursor&lt;/li&gt;
	&lt;li&gt;in the case of findOne it would represent the stats of a single document because only one document in the cursor (thus by implementing it at the cursor level it covers both single document and aggregation scenarios)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Return documents and stats embedded using a flag on the find() operation:&lt;/p&gt;

&lt;p&gt;db.col.find({}, &lt;/p&gt;
{stats:true}
&lt;p&gt;);&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;stats could be attached as an embedded document in the _stats key on each document&lt;/li&gt;
	&lt;li&gt;as the stats would be located beside the document on disk it should be a quick and efficient operation to perform&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;As you can see from the examples above this would be best implemented on the server cursor. I would suggest storing stats meta data beside documents on disk as opposed to storing them in a separate hash table or other data structure. This is to ensure efficient retrievals of both documents and stats in a flexible manner and to ensure writes remain fast.&lt;/p&gt;</description>
                <environment></environment>
        <key id="55257">SERVER-7549</key>
            <summary>document level stats</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-execution">Backlog - Query Execution</assignee>
                                    <reporter username="mattcampbell">Matt Campbell</reporter>
                        <labels>
                            <label>document</label>
                            <label>stats</label>
                    </labels>
                <created>Mon, 5 Nov 2012 06:00:37 +0000</created>
                <updated>Tue, 6 Dec 2022 05:27:46 +0000</updated>
                                            <version>2.3.0</version>
                                                    <component>Admin</component>
                    <component>Storage</component>
                                        <votes>1</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="2156338" author="milkie" created="Tue, 19 Feb 2019 21:47:08 +0000"  >&lt;p&gt;The aggregation pipeline could provide this sort of information with new operators.&lt;/p&gt;</comment>
                            <comment id="183951" author="mattcampbell" created="Thu, 8 Nov 2012 07:09:45 +0000"  >&lt;p&gt;For both single and aggregated doc stats:&lt;/p&gt;

&lt;p&gt;ns (collection which document is stored in - useful if you are passing objects around a system without being context bound or have a wrapper)&lt;br/&gt;
dataSize/size (size of the document data)&lt;br/&gt;
storageSize (size of storage allocated to document, ie includes overheads like padding - as close as possible to physical disk usage)&lt;/p&gt;

&lt;p&gt;For aggregated doc stats:&lt;/p&gt;

&lt;p&gt;count (number docs in cursor / stats aggregate)&lt;br/&gt;
avgDocSize (datasize divided by count)&lt;/p&gt;


&lt;p&gt;Possible ideas (not considered core):&lt;/p&gt;

&lt;p&gt;count of keys per doc (could be top level or drilldown into embedded docs)&lt;br/&gt;
Indexes used by a document (purely a match of collection indexes to document keys)&lt;/p&gt;

&lt;p&gt;RATIONALE:&lt;/p&gt;

&lt;p&gt;ns - allows a document to traverse through an application knowing its &apos;home&apos; and having identity&lt;/p&gt;

&lt;p&gt;dataSize - useful for clients which may be bandwidth aware and want to know the size of set of document before choosing to pull them down the wire (ie think mobile or other bandwidth constrain or resource constrained device). This would allow them to make decisions on how much data to pull down.&lt;/p&gt;

&lt;p&gt;storageSize - in multi-tenant environments this would allow us to quickly report the physical disk used by a set of documents belonging to a client (contained in a single shared collection). Eg a multi-tenant collection of products we would be able to quickly report the disk usage in a dashboard to each user for that type of object&lt;/p&gt;

&lt;p&gt;count - simple - number docs in cursor&lt;br/&gt;
avgDocSize - again useful for bandwidth aware clients when looking at a set of documents in a cursor as opposed to a single document where dataSize would make more sense. The client could calculate this using dataSize and count on a set of documents.&lt;/p&gt;</comment>
                            <comment id="183929" author="eliot" created="Thu, 8 Nov 2012 06:00:55 +0000"  >&lt;p&gt;Besides size, what stats are you looking for?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="504223">SERVER-33582</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25125"><![CDATA[Query Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 8 Nov 2012 06:00:55 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 51 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 51 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-query-execution</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>mattcampbell</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnj0f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2gmv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6669</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjd3z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>