MongoDB
Перейти к навигации
Перейти к поиску
Переводчик команд MySQL -> MongoDB
MySQL | MongoDB | |
---|---|---|
SHOW DATABASES | show dbs | |
CREATE DATABASE test | use test | |
SHOW TABLES | show collections | |
INSERT INTO `test` ... | db.test.insert({"created":new ISODate("2020-05-18T14:10:30Z"), "edited":new ISODate("2021-05-18T14:10:30Z"), "md5":"1f8b0359ce8edfa9f2a00549220ed9bb", "name":"Test", "integer":123, "float":12.3, "text":"asdfasdfasdf", "doc":{"test":"test"}}) | |
SELECT * FROM test | db.test.find() | |
TRUNCATE TABLE test | db.test.remove({}) | |
SELECT * FROM test \G | db.test.find().pretty() | |
ALTER TABLE test ADD UNIQUE INDEX name(name, md5) | db.test.createIndex({"name": 1, "md5": 1}, {unique: true}) |