I am using CosmosDB MongoDB API for store and retrieval of documents in the collections.
I am trying to use the sort collection.find({}).sort({field1: 1} and seeing this error:
"message": "Failed to retrieve the document:MongoError: Error=2, Details='Response status code does not indicate success:
BadRequest (400); Substatus: 0; ActivityId: d05b7772-3252-4005-898f-4480cadfb8e1; Reason:
(Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId:
d05b7772-3252-4005-898f-4480cadfb8e1; Reason: (Response status code does not indicate success: BadRequest (400);
Substatus: 0; ActivityId: d05b7772-3252-4005-898f-4480cadfb8e1; Reason: (Message: {\"Errors\":
[\"The index path corresponding to the specified order-by item is excluded.\"]}\r\nActivityId: d05b7772-3252-4005-898f-4480cadfb8e1,
Request URI: /apps/e118124c-80f3-408e-a2f9-fbea51664ad4/services/5cb63213-f046-49d6-9825-0bfa4010772e/partitions
/68271031-2d85-44cd-9929-8857ff69b63e/replicas/132696733163313635s/,
RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum,
SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0);););"
Does it mean without having an index, we can not do a sort on MongoDB?
Wondering is this the MongoDB behavior or the CosmosDB behavior? Not sure.
Second issue is: I want to have a string search across all fields, like this:
collection.find({"$text":{"$search":"findMeOut"}});
However here I am seeing this Mongo Error:
MongoError: $text not supported
Now what this means?
I am using CosmosDB MongoDB API using JavaScript and and NodeJs native MongoClient with the following versions:
"mongodb": "^3.6.10",
"fastify-mongodb": "^2.0.1",
Thanks.