Skip to content

Instantly share code, notes, and snippets.

@newswim
Created December 2, 2015 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newswim/508f453926fb1de842ed to your computer and use it in GitHub Desktop.
Save newswim/508f453926fb1de842ed to your computer and use it in GitHub Desktop.
dump of some mongo shell things
### trying to deploy to aws via distelli
> show profile
db.system.profile is empty
Use db.setProfilingLevel(2) will enable profiling
Use db.system.profile.find() to show raw profile entries
> admin.help()
Wed Dec 2 20:05:29.741 ReferenceError: admin is not defined
> show dbs
admin 0.203125GB
local 0.078125GB
test (empty)
> db.admin.help()
DBCollection help
db.admin.find().help() - show DBCursor help
db.admin.count()
db.admin.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied.
db.admin.convertToCapped(maxBytes) - calls {convertToCapped:'admin', size:maxBytes}} command
db.admin.dataSize()
db.admin.distinct( key ) - e.g. db.admin.distinct( 'x' )
db.admin.drop() drop the collection
db.admin.dropIndex(index) - e.g. db.admin.dropIndex( "indexName" ) or db.admin.dropIndex( { "indexKey" : 1 } )
db.admin.dropIndexes()
db.admin.ensureIndex(keypattern[,options]) - options is an object with these possible fields: name, unique, dropDups
db.admin.reIndex()
db.admin.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return.
e.g. db.admin.find( {x:77} , {name:1, x:1} )
db.admin.find(...).count()
db.admin.find(...).limit(n)
db.admin.find(...).skip(n)
db.admin.find(...).sort(...)
db.admin.findOne([query])
db.admin.findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } )
db.admin.getDB() get DB object associated with collection
db.admin.getIndexes()
db.admin.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )
db.admin.insert(obj)
db.admin.mapReduce( mapFunction , reduceFunction , <optional params> )
db.admin.remove(query)
db.admin.renameCollection( newName , <dropTarget> ) renames the collection.
db.admin.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection name
db.admin.save(obj)
db.admin.stats()
db.admin.storageSize() - includes free space allocated to this collection
db.admin.totalIndexSize() - size in bytes of all the indexes
db.admin.totalSize() - storage allocated for all data and indexes
db.admin.update(query, object[, upsert_bool, multi_bool]) - instead of two flags, you can pass an object with fields: upsert, multi
db.admin.validate( <full> ) - SLOW
db.admin.getShardVersion() - only for use with sharding
db.admin.getShardDistribution() - prints statistics about data distribution in the cluster
db.admin.getSplitKeysForChunks( <maxChunkSize> ) - calculates split points over all chunks and returns splitter function
> ^C
bye
ubuntu@ip-172-31-33-205:/distelli/_apps/FrackNews.fracknews-prod.d-m3fppsh37wea1f656d59$ meteor shell
Server unavailable (waiting to reconnect)
^C
ubuntu@ip-172-31-33-205:/distelli/_apps/FrackNews.fracknews-prod.d-m3fppsh37wea1f656d59$ meteor --help
Usage: meteor [--release <release>] [--help] <command> [args]
meteor help <command>
meteor [--version] [--arch]
With no arguments, 'meteor' runs the project in the current
directory in local development mode. You can run it from the root
directory of the project or from any subdirectory.
Use 'meteor create <path>' to create a new Meteor project.
Commands:
run [default] Run this project in local development mode.
debug Run the project, but suspend the server process for debugging.
create Create a new project.
update Upgrade this project's dependencies to their latest versions.
add Add a package to this project.
remove Remove a package from this project.
list List the packages explicitly used by your project.
add-platform Add a platform to this project.
remove-platform Remove a platform from this project.
list-platforms List the platforms added to your project.
build Build this project for all platforms.
lint Build this project and run the linters printing all errors and warnings.
shell Launch a Node REPL for interactively evaluating server-side code.
mongo Connect to the Mongo database for the specified site.
reset Reset the project state. Erases the local database.
deploy Deploy this project to Meteor.
logs Show logs for specified site.
authorized View or change authorized users and organizations for a site.
claim Claim a site deployed with an old Meteor version.
login Log in to your Meteor developer account.
logout Log out of your Meteor developer account.
whoami Prints the username of your Meteor developer account.
test-packages Test one or more packages.
admin Administrative commands.
list-sites List sites for which you are authorized.
publish-release Publish a new meteor release to the package server.
publish Publish a new version of a package to the package server.
publish-for-arch Builds an already-published package for a new platform.
search Search through the package server database.
show Show detailed information about a release or package.
See 'meteor help <command>' for details on a command.
ubuntu@ip-172-31-33-205:/distelli/_apps/FrackNews.fracknews-prod.d-m3fppsh37wea1f656d59$ meteor whoami
Not logged in. 'meteor login' to log in.
ubuntu@ip-172-31-33-205:/distelli/_apps/FrackNews.fracknews-prod.d-m3fppsh37wea1f656d59$ meteor admin
Try 'meteor admin help' for available commands.
ubuntu@ip-172-31-33-205:/distelli/_apps/FrackNews.fracknews-prod.d-m3fppsh37wea1f656d59$ meteor admin help
Usage: meteor admin <command> [args]
meteor help admin <command>
Rarely used commands for administering official Meteor services.
Commands:
maintainers View or change package maintainers.
recommend-release Recommend a previously published release.
change-homepage Change the homepage url of a package.
list-organizations List the organizations of which you are a member.
members View or change the members of an organization.
get-machine Open an ssh shell to a machine in the meteor build farm.
See 'meteor help admin <command>' for details on an admin command.
me$ meteor admin get-machine
admin get-machine: not enough arguments.
Usage: meteor admin get-machine <arch> [--json] [--verbose] [--minutes min]
Asks the meteor build farm for a build server and opens a secure shell to it.
Valid machine architectures are:
os.osx.x86_64
os.linux.x86_64
os.linux.x86_32
os.windows.x86_32
Options:
--json return information in JSON form instead of opening a shell
--minutes specify the length of the reservation
--verbose print all output from commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment