I am building an ASP.Net web application and want to access data from MongoDB (remotely hosted). Any of my documents looks like this (have ensured index on Utc field);
{
"_id" : { "$oid" : "509501393e8785025c10bc21" },
"Index" : 1,
"Url" : "http:...",
"CameraId" : 123,
"Utc" : { "$date" : 1351955858006 }
}
Considering the performance on user end, I want to fetch this data at max speed. One option that i have tried is calling a local Web Service via JSON on Page.aspx which uses MongoDB C# driver to query documents between two Dates (Utc). That works but seems like using web service adds some extra milliseconds in request/response cycle (request for single document using db.foo.findOne() is served in 1.3 seconds on average). Average number of documents in that collection is 50,000 which will increase up-to 30,00,000.
My questions are:
- Am i right in saying that using web services adds some delay (millisecs) in request/response cycle ? (because MongoDB actually takes few milliseconds to complete the query)
- Second Option is to use MongoDB's HTTP / REST Interface. That way i might avoid web services and directly query MongoDB. Here
i need your opinion on,
- Is there a way to query MongoDB between two Dates using HTTP/REST ?,
- Is there a way to query MongoDB with '>' and '<' conditions using HTTP/REST ?,
- How does it seem, accessing DB directly on Page.aspx with security point of view ?
- Any other querying alternative OR optimizations for above schema?
My related question is here.
Regards.