<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35: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>[GODRIVER-1218] How to create a TTL index on a collection</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1218</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;How can I go about doing something like what is defined here:&#160;&lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/expire-data/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/tutorial/expire-data/&lt;/a&gt;&#160;using Go MongoDB driver?&lt;/p&gt;

&lt;p&gt;I presume I would have to do this at the collection level. It doesn&apos;t seem like I can use RunCommand on a collection object.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The specific command I am trying to run would be `db.log_events.createIndex( &lt;/p&gt;
{ &quot;createdAt&quot;: 1 }
&lt;p&gt;, &lt;/p&gt;
{ expireAfterSeconds: 3600 }
&lt;p&gt; )`.&lt;/p&gt;</description>
                <environment>macOS/Ubuntu</environment>
        <key id="884384">GODRIVER-1218</key>
            <summary>How to create a TTL index on a collection</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="ajlee1000">Andrew Lee</reporter>
                        <labels>
                    </labels>
                <created>Mon, 5 Aug 2019 19:37:36 +0000</created>
                <updated>Mon, 12 Aug 2019 12:38:53 +0000</updated>
                            <resolved>Mon, 12 Aug 2019 12:38:53 +0000</resolved>
                                    <version>1.0.4</version>
                                                    <component>Core API</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2361861" author="ajlee1000" created="Wed, 7 Aug 2019 19:41:27 +0000"  >&lt;p&gt;Nevermind. I figured it out.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;For anyone wondering, the code is as follows:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;{{&lt;tt&gt;db := client.Database(DB_NAME) db := client.Database(DB_NAME)&lt;/tt&gt;&lt;tt&gt;collection :=&#160;client.Database(DB_NAME).Collection(_COLLECTION_NAME)&lt;/tt&gt;&lt;tt&gt;&#160;&lt;/tt&gt;&lt;tt&gt;opts := options.CreateIndexes() opts := options.CreateIndexes()&lt;/tt&gt;}}&lt;br/&gt;
{{ {{ keys := bsonx.Doc{{Key: &quot;createdAt&quot;, Value: bsonx.Int32(int32(1))}} index := mongo.IndexModel{} index.Keys = keys index.Options = options.Index().SetExpireAfterSeconds(60)}}}}&lt;br/&gt;
{{ {{ collection.Indexes().CreateOne(context.Background(), index, opts)}}}}&lt;br/&gt;
{{ {{ if err != nil &lt;/p&gt;
{ log.Fatal(err) }
&lt;p&gt;}}}}&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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|hv7y7j:</customfieldvalue>

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