DocumentDB And MongoDB
Document database, basically store the database as json.
The way that it works is you have collections
which is like tables in RDBS.
You can insert a record into collections
db.getCollection("Customers").insertOne({
text: "hello"
})
The thing is items in the collections don't need to follow a particular order unlike Cassandra. Therefore you can put in a completely different structure for example
db.getCollection("Customers").insertOne({
name: "customer"
})
[!note]
In Cassandra, you need to define the column with the correct type like RDBS to insert a data. If you insert a data without a column, it will throw an error
When you get one item out, it will only have the fields you insert. For example for the above
db.getCollection("Customers").find({ name: "customer" })
will return
{
_id: 123124910121 //some random id mongodb generated for us
name: "customer"
}
db.getCollection("Customers").find({ text: "hello" })
{
_id: 310230120301230230,
text: "hello"
}