Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MongoDBADS MongoSQL
db.baseball.insert( {
	"teamName": "Dodgers",
	"city": "Los Angeles",
	"division":"NL",
	"managerName": { "first":"Joe", "last":"Torre" },
	"colors": [ "blue", "white" ],
	"worldChampionships": 6,
	"stats":
	[
		{
		"year":2010,
		"wins":80,
		"losses":82,
		"winPercentage":0.494
		},
		{
		"year":2011,
		"wins":82,
		"losses":79,
		"winPercentage":0
		},
		{
		"year":2012,
		"wins":0,
		"losses":0,
		"winPercentage":0
		}
	]
} )
INSERT INTO baseball
VALUES (
{
    "teamName":"Dodgers",
    "city":"Los Angeles",
    "division":"NL",
    "managerName": { "first":"Joe", "last":"Torre" },
    "colors": [ "blue", "white" ],
    "worldChampionships": 6,
    "stats":
    [
        {
        "year":2010,
        "wins":80,
        "losses":82,
        "winPercentage":0.494
        },
        {
        "year":2011,
        "wins":82,
        "losses":79,
        "winPercentage":0
        },
        {
        "year":2012,
        "wins":0,
        "losses":0,
        "winPercentage":0
        }
    ]
} )

Back to top

UPDATE Support

Query Reference: UPDATE

...