Category: javascript

React Native must have libraries

Posted by – April 16, 2016

Here’s a small list of must have libraries for every react native project:

Some of these libraries aren’t mandatory, but there have been used in many projects outside there, feel free to suggest new ones!

Share

MongoDB and the rest of NoSQL solutions

Posted by – August 8, 2009

In the last weeks I have been evaluating two NoSQL solutions available in the market, MongoDB and CouchDB, each solution has very interesting features, but besides of its features we must consider how much easy to use each one is, right?

Let’s talk a little about CouchDB first, CouchDB is a document-oriented solution written in Erlang language, with CouchDB you can easily persist documents in JSON format it also has a very powerful RESTful interface from where you can retrieve database information and persist/query documents.

But how to perform basic operations on CouchDB like persist or query data? It’s simple, you just need to know how to use its RESTful interface, the example below shows how much easy is persist data in CouchDB with help of curl tool:

1
curl -X PUT -d '{"name": "Rogerio Araujo", "address": "Estrada dos Bandeirantes", "city": "Rio de Janeiro", "state": "RJ", "country": "Brazil" }' "http://127.0.0.1:5984/contacts/user3"

The command above will create the following JSON document on database:

1
{ "_id": "user3", "_rev": "3771096703", "name": "Rogerio Araujo", "address": "Estrada dos Bandeirantes", "city": "Rio de Janeiro", "state": "RJ", "country": "Brazil" }

Once we have few documents stored on CouchDB we need to create a view used to help on query data, to do it, you must write the following javascript function and store it as a document on database:

1
2
3
4
function(doc) {
  if(doc.name)
     emit(doc.name, doc);
}

More

Share