Pergunta

Me and my colleges are having second thoughts on using MongoDB to store al the data for our application. Some think that because of Mongo's eventual consistency when user register or updates his profile (or something similar but more important) the result won't be seen immediately and could frustrate users.

I'm pretty sure unless we have a ton of data and we do some replication we won't see the effects of eventual consistency. But I'm not sure.

Any advice? Use only mongo or add an additional SQL server for storing sensitive data?

Foi útil?

Solução

MongoDB is not eventually consistent, but it has asynchronous replication. You can avoid the risk of reading an old value by not reading from slaves (a simple connection flag), or writing wit a flag that waits for the replication to have finished before returning. Look atthedocumentation gor the getLastError command for all the details on the latter.

Using MongoDB forwhat you're describing is fine.

Outras dicas

Lets answer a different question first: Do you need special capabilities of MongoDB or could you use a plain old relational data store?

I can't answer that one (you can).

If the answer is "no" you could switch everything to an ACID SQL database and have no worries anymore with such problems.

Fully elaborating on the trade-off between NoSQL and SQL would exceed the limits of this text editor. I recommend you do some research on that on the web.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top