Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9926

2dsphere index requires field. "Can't parse geometry from element: location: null"

    • Fully Compatible
    • ALL
    • Hide

      In terminal:
      > mongo
      > use test
      > db.items.insert([ { location:

      { lng: 1, lat: 2 }

      },

      { location: null }

      ])
      > db.items.ensureIndex(

      { location: '2dsphere' }

      )

      {
      "err" : "Can't parse geometry from element: location: null",
      "code" : 16700,
      "n" : 0,
      "connectionId" : 132,
      "ok" : 1
      }

      Show
      In terminal: > mongo > use test > db.items.insert([ { location: { lng: 1, lat: 2 } }, { location: null } ]) > db.items.ensureIndex( { location: '2dsphere' } ) { "err" : "Can't parse geometry from element: location: null", "code" : 16700, "n" : 0, "connectionId" : 132, "ok" : 1 }

      Trying to create 2dsphere index for collection on field that sometimes in null.
      It allows to create 2d index, but not 2dsphere.

            Assignee:
            Unassigned Unassigned
            Reporter:
            moka Maksims Mihejevs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: