Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
New Member
Posts: 1
Registered: ‎02-21-2018

Geospatial index querying doesn't work on Azure CosmosDB (DocumentDB) using the Mongo API

[ Edited ]

Hello All, I'm newbibe to this site, i have question for you guy's go through it!

 

I have an Azure CosmosDB with a collection restaurants where a field geoJSON specifies the location of a restaurant in geoJSON format. I am using the MongoDB API to access this.

 

When I log into the Microsft Azure DB using the mongo shell, I am able to see all the documents using db.restaurants.find(). I created a 2dsphere geospatial index using db.restaurants.createIndex( {geoJSON: "2dsphere"}).

output:

 

{
    "_t" : "CreateIndexesResponse",
    "ok" : 1,
    "createdCollectionAutomatically" : false,
    "numIndexesBefore" : 3,
    "numIndexesAfter" : 4
}

However, upon running db.restaurants.getIndexes(), I still see only three indexes. This question says that indexing is not allowed. Is this still the case?

Furthermore, there seems to be an index called

 

{
            "v" : 1,
            "key" : {
                    "DocumentDBDefaultIndex" : "2dsphere"
            },
            "name" : "DocumentDBDefaultIndex_2dsphere",
            "ns" : "<redacted>"
}

but executing a geospatial query returns nothing.

 

db.restautants.find({DocumentDBDefaultIndex: {$near: {$geometry: {type: "Point", coordinates: [24.9430111, 60.166608]}, $maxDistance: 1000}}})

How can I execute geospatial queries against this index using the mongo shell? Is this a bug in CosmosDB?

 

Help me on this

 

Thanks

 

 

 

 

 

Polls
Please register to vote
Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.