mongodb syntax MySQL syntax db.test.find ({'name':'Foobar'})<==> Select * fromTestwhereName='Foobar'Db.test.find ()<==> Select * fromTest Db.test.find ({'ID':Ten}).Count()<==> Select Count(*) fromTestwhereId=Tendb.test.find (). Skip (Ten). Limit ( -)<==> Select * fromTest limitTen, -Db.test.find ({'ID':{$inch:[25,35,45]}})<==> Select * fromTestwhereIdinch( -, *, $) Db.test.find (). Sort ({'ID':-1})<==> Select * fromTestOrder byIddescdb.test.distinct('name',{'ID': {$lt: -}})<==> Select distinct(name) fromTestwhereId< -db.test.Group({Key:{'name': true},cond:{'name':'Foo'},reduce:function(Obj,prev) {Prev.msum+=Obj.marks;},initial:{msum:0}})<==> SelectNamesum(marks) fromTestGroup byname Db.test.find ('this.id<20', {name:1})<==> SelectName fromTestwhereId< -db.test.Insert({'name':'Foobar',' Age': -})<==>Insert intoTest ('name',' Age')Values('Foobar', -) Db.test.remove ({})<==> Delete * fromTest Db.test.remove ({' Age': -})<==> DeleteTestwhereAge= -Db.test.remove ({' Age': {$lt: -}})<==>Elete TestwhereAge< -Db.test.remove ({' Age': {$lte: -}})<==> DeleteTestwhereAge<= -Db.test.remove ({' Age': {$gt: -}})<==> DeleteTestwhereAge> -Db.test.remove ({' Age': {$gte: -}})<==> DeleteTestwhereAge>= -Db.test.remove ({' Age': {$ne: -}})<==> DeleteTestwhereAge!= -db.test.Update({'name':'Foobar'},{$Set:{' Age': $}})<==> UpdateTestSetAge= $ whereName='Foobar'db.test.Update({'name':'Foobar'},{$inc: {' Age':3}})<==> UpdateTestSetAge=Age+3 whereName='Foobar'
MongoDB vs. MySQL