---
layout: post
title: "MongoDB"
subtitle: ""
date: 2015-7-24 12:00:00
author: "rightpeter"
---

# Update()

Reference to
[mongoDB](http://docs.mongodb.org/manual/reference/operator/update/set/)

Example:

    db.products.update(
        { _id: 100 },
        {
            {
                quantity: 500,
                details: { model: "14Q3", make: "xyz" },
                tags: [ "coats", "outerwear", "clothing" ]
            }
        }
    )


---
layout: post
title: "MongoDB"
subtitle: ""
date: 2015-7-24 12:00:00
author: "rightpeter"
---

# Update()

Reference to
[mongoDB](http://docs.mongodb.org/manual/reference/operator/update/set/)

Example:

    db.products.update(
        { _id: 100 },
        {
            {
                quantity: 500,
                details: { model: "14Q3", make: "xyz" },
                tags: [ "coats", "outerwear", "clothing" ]
            }
        }
    )

- - - -

# Find schema of a collection in MongoDB

Reference to [Optimal.io](http://blog.optimal.io/how-to-find-the-schema-of-a-collection-in-mongodb/)

Open a mongo shell and run the following commands:

    MongoDB shell versio: x.x.x
    > show dbs
    local 0.078GB
    todo 0.xxGB
    > use todo
    switched to db todo
    > show collections
    system.indexes
    tasks
    > var scematodo = db.tasks.findOne():
    > for (var key in schematodo) { print (key) ; }
    _id
    label
    content

- - - -

Add find schema of collections
Add find schema of collections
