are adhoc queries/updates starting to kill your pr

2019-05-03 13:10发布

问题:

i've been developing a asp mvc website for almost a year now exclusively on mongodb. i've loved it for the most part. development productivity has been great using a C# mongodb driver and tools like mongovue.

however, i've started to reach a point where there are things i really wish i had a SQL server database for. simple tasks like updating a record in the DB and only mildly complex queries to generate some type of report are becoming a pain.

i read an article somewhere that in order for NOSSQL to succeed there needs to be a standard query language for it, and tools developed around it. i'm guessing this is far far away, so right now i'm stuck trying to deal with these things.

i think eventually i will have to have a dual solution with monogDB and sql server. i don't think i will ever get to the point where i am as productive updating and writing queries for mongoDB as i was with sql server.

how are you guys dealing with this when using NOSQL like mongodb? are you facing the same issues as me?

回答1:

One solution you may consider is LINQPad. You can set up a template with a reference to 10Gen's drivers and write ad-hoc, C# MongoDB queries like you would in your code. My team and I use this method to address the very problem you mention.

Try it out (it's free) and see if it can help with the simple, day-to-day queries you come up with.

Edit I also support Chris's suggestion of familiarizing yourself with the native JSON query language. Nothing beats a quick console window for speed, if you know the syntax.



回答2:

The official C# driver will probably get a LINQ provider some time in the future, so that'd give .NET devs a familiar syntax for querying and maybe help with initial productivity. There're also some nice docs that help relate MongoDB queries back to SQL:

  • SQL to Mongo Mapping Chart
  • SQL to MongoDB (PDF)

These are great for learning, but to get the most out of Mongo it's well worth investing time getting used to the native JSON query syntax and Mongo-specific concepts like map-reduce.



回答3:

Since your questions asks,

how are you guys dealing with this when using NOSQL like mongodb?

I thought I'd chime in. I felt your pain when working with another NOSQL database, RavenDB.

I wrote a Linqpad driver specifically for ad hoc interactions with RavenDB.

https://github.com/ronnieoverby/RavenDB-Linqpad-Driver



标签: mongodb nosql