NoSQL (e.g. MongoDB) or RDMS (e.g. PostgreSQL) for a new Scala project?

I am developing a completely new project in Scala. However, this is just an application for several CRUD operations, however, due to some eccentric requirements, Play2 or Lift are not suitable for counting, so I'm going to develop the application from scratch. This means that Anorm or ScalaQuery is becoming a less obvious choice for integration with the database and leaves me with the question: is it time to try something new?

My past technology stacks mainly included Java and PostgreSQL, and I have experience with ORM and plain SQL. Are NoSQL database management systems like MongoDB a good replacement for regular RDBMS, or are they special application data repositories? Also, how does database choice affect the higher Scala system design (if at all)? For example, the fact that you use a JSON-like interface to talk to the database and JSON between the network and the REST service does not mean that if everything in the middle becomes Scala objects or does it?

I basically ask someone to experience moving from relational databases like an object / document, in particular with Scala. I know that good integration with RDBMS is promised in the upcoming version of SLICK. So, if a company such as TypeSafe decides to do part of the RDBMS integration in the TypeSafe stack, then will I float upstream, integrating into MongoDB, for example, using Casbah?

Apologizes if this question seems a bit vague. I hope someone with the right knowledge or experience can help, though.

Update:

Sorry for not adding SLICK links (this is pretty new). Here:

Update 2:

My personal first victory for technology is usually the productivity of developers - it's easy and simple: learn fast, easy to maintain, not magic

+7
source share
3 answers

I am currently in a similar situation, and since I have some experience with web development and SQL databases, I took this as an opportunity to work with MongoDB, Cashbah (and Scalatra ). My experience is still very limited, and the project and the amount of data I work with are pretty small, but here are a few comments that I made.

  • For the multiple datasets that I have, performance does not seem to motivate SQL or NoSQL. However, performance in the presence of huge amounts of data is often referred to as the reason for using NoSQL, for example on Wikipedia

  • My documents (records in the database) arise from tests of test tests and basically have a static structure, and I am optimistic that I can store them in a fixed-schema SQL database. However, several substructures are not static, for example, new test cases are added, new statistics are tracked, others are deleted. This was my main motivation for using the NoSQL schematic database. Also, since I got the feeling that the MongoDB document approach makes it much more obvious which data belongs together (i.e., to a document), unlike records in a relational database, where the data will be distributed across different tables and rows, and where the full โ€œdocumentโ€ will need to be restored by combining.

  • Tools, such as Lift-Json or Rogue , allow you to work with ordinary Scala objects in a safe type, although the data is regularly (deaerated) as (c) JSON. However, this, of course, works best if the structure of your data is mostly static, otherwise you only need to use strings to access your data (for example, to expand query results using Cashbah).



If you are mostly concerned about the consistent presentation of data on the server and client side, languages โ€‹โ€‹like Opa or Haxe may be of interest, as they are compiled into code that can be executed on both sides. See this page for multi-charge or multi-level languages.

+5
source

Too long for comment. Just tried to connect my short experience with Scala (about 6 months, since approximately when Play2 came out, it quickly became my language).

I enjoyed using Salat / Casbah with MongoDB in my last few projects; most of them were in Play2, but the latter were without a webapp framework. He definitely did not want to swim upstream.

I would say that there are specific use cases for which I would not use mongo, but it works well as a general-purpose object data store, especially if you expect a request by id or index and do not need transactions (and require a minimum type of aggregation type ad-hoc).

Expect that you will need a separate set of servers dedicated to mongodb (or to use the mongodb dedicated service), but I assume this is normal for most serious database applications.

I also used Play2 / Anorm, which was surprisingly nice to use for some pages of the report in the style of ad-hoc request. I started trying to follow the Squeryl route, but Anorm seemed easier to use for one-time aggregation requests. Didn't look SLICK, but that sounds interesting.

+3
source

It is very difficult to say without knowing what problems you want to solve.

I personally found that my performance increased using NoSQL DB through REST / JSON. Despite the fact that most NoSQL databases offer REST interfaces that eliminate the need for a lot of middleware, Scala or otherwise, if you are not going to write a webapp with a user interface.

If this is a training exercise, I recommend you try a few things, since each NoSQL database has something else to offer your toolkit, and I personally found CouchDB, Riak, Neo4j, and MongoDb with various pros and cons and is good for different purposes.

Hope this helps, good luck.

+2
source

All Articles