From Boldcore's wiki
Jump to: navigation, search
(Created page with "=MongoDB= ==Nothing useful== Raised on MySQL, I am new to mongo, and I need to get more familiar with the syntax. Just a random pastes from cmdline. <pre> Insert shit: ...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
==Nothing useful==
 
==Nothing useful==
 
Raised on MySQL, I am new to mongo, and I need to get more familiar with the syntax.
 
Raised on MySQL, I am new to mongo, and I need to get more familiar with the syntax.
 +
Mongo's NoSQL is very attractive to me.
 
Just a random pastes from cmdline.
 
Just a random pastes from cmdline.
  
 
<pre>
 
<pre>
 
/* Insert shit */
 
/* Insert shit */
> db.pers.insert("name":"Peter","age":"7","colour":"red")
+
> db.pers.insert({"name":"Peter","age":"7","colour":"red"})
  
 
/* Retrieve shit */
 
/* Retrieve shit */
Line 20: Line 21:
 
>
 
>
  
 +
db.createCollection("tabulka")
  
 
</pre>
 
</pre>

Latest revision as of 06:21, 21 April 2017

MongoDB

Nothing useful

Raised on MySQL, I am new to mongo, and I need to get more familiar with the syntax. Mongo's NoSQL is very attractive to me. Just a random pastes from cmdline.

/* Insert shit */
> db.pers.insert({"name":"Peter","age":"7","colour":"red"})

/* Retrieve shit */

> db.pers.find({"name":"Peter"}).pretty()
{
        "_id" : ObjectId("58c950e7fe9fddf65dd0e8d5"),
        "name" : "Peter",
        "age" : "7",
        "colour" : "red"
}
>

db.createCollection("tabulka")