Created
February 21, 2014 22:18
-
-
Save sheki/9144793 to your computer and use it in GitHub Desktop.
mongo_script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MongoDB shell version: 2.2.2 | |
| connecting to: test | |
| > c = db.test | |
| test.test | |
| > c.insert{a : 10, b:10} | |
| Fri Feb 21 14:15:27 SyntaxError: missing ; before statement (shell):1 | |
| > c.insert({a : 10, b:10}) | |
| > c.insert({a : 11, b:11}) | |
| > c.find() | |
| { "_id" : ObjectId("52fc16614a1d457dfe834cae"), "a" : 1234, "b" : 5678 } | |
| { "_id" : ObjectId("5307d00862b8202fb0dddeda"), "a" : 10, "b" : 10 } | |
| { "_id" : ObjectId("5307d00d62b8202fb0dddedb"), "a" : 11, "b" : 11 } | |
| > c.ensureIndex({a:1,b:1}) | |
| > c.getIndexes() | |
| [ | |
| { | |
| "v" : 1, | |
| "key" : { | |
| "_id" : 1 | |
| }, | |
| "ns" : "test.test", | |
| "name" : "_id_" | |
| }, | |
| { | |
| "v" : 1, | |
| "key" : { | |
| "a" : 1, | |
| "b" : 1 | |
| }, | |
| "ns" : "test.test", | |
| "name" : "a_1_b_1" | |
| } | |
| ] | |
| > c.indexInfo() | |
| Fri Feb 21 14:17:35 TypeError: c.indexInfo is not a function (shell):1 | |
| > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment