lawry
lawry

Reputation: 81

Cosmos Mongo API NumberLong query cannot find document

I'm using Azure Cosmos DB Mongo API with a Cosmos account created over a year ago.

I just created a new database with shared RU/s a few days ago and added a couple of documents, one of them is like this:

{
  "_id" : "9a0f33b3-1710-41f8-a8e4-55de05d4c8ec",
  "modifiedTick" : NumberLong("637163955868423736")
}

In mongo shell I tried to query for this document but the query did not return any results.

db.Dev.find( { modifiedTick: NumberLong("637163955868423736") } )

I find it odd that the query cannot find the document! Can anyone please help with the reason why? I tried the same thing on a Cosmos database created over a year ago (the database does not have a shard key) and the same query can find the document.

Even more bizarre is the fact that I can use a $gte + $lte query with a different value to find that document. Here is a screen shot to show what I mean:

Whacky query result.

Thanks in advance.

Upvotes: 1

Views: 126

Answers (1)

lawry
lawry

Reputation: 81

It's a bug. Create a new Cosmos account using the latest server version of Mongo API and a new database collection. Migrate the data across to the new server/database/collection and the query should work in the new collection.

Upvotes: 0

Related Questions