title: Mongodb 2dsphere index for nested array field
body: <p>I have created collection and a object is looks like this.</p>
  
  <pre><code>[_id] =&gt; MongoId Object (
      [$id] =&gt; 53087f483b15eaeb6c3c9869
  )
  [time_from] =&gt; 2014-02-22 00:00:00
  [time_to] =&gt; 2014-02-22 00:10:00
  [checkin] =&gt; Array (
      [0] =&gt; Array (
          [time_frame] =&gt; 2014-02-22 00:00:56
          [user_id] =&gt; 1
          [loc] =&gt; Array (
              [type] =&gt; Point
              [coordinates] =&gt; Array (
                  [0] =&gt; 73.43
                  [1] =&gt; 42.22
              )
          )
      )
      [1] =&gt; Array (
          [time_frame] =&gt; 2014-02-22 00:00:56
          [user_id] =&gt; 2
          [loc] =&gt; Array (
              [type] =&gt; Point
              [coordinates] =&gt; Array (
                  [0] =&gt; 73.10
                  [1] =&gt; 42.97
              )
          )
      )
  }
  </code></pre>
  
  <p>I need to create "2dsphere" index for 'loc' field. The checkin field has all the location coordinates stored in array format.</p>
  
  <p>I tried creating index like below.</p>
  
  <pre><code>db.&lt;collection&gt;.ensureIndex( { "checkin.loc" : "2dsphere"  } );
  </code></pre>
  
  <p>and I got this below error message.</p>
  
  <pre><code>"err" : "Can't extract geo keys from object, malformed geometry?:{ type: \"Point\", coordinates: [ \"73.10\", \"40.73\" ] }"
  </code></pre>
  
  <p>What I am missing? Any help would be appreciated! Thanks in advance.</p>