Posts SQL vs MongoDB
Post
Cancel

SQL vs MongoDB

1
2
3
SELECT  *
FROM    users
WHERE   signup_time >= CURDATE() - INTERVAL 1 DAY

MongoDB (convert the 24 hours to milliseconds on your own)

1
2
3
4
5
db.users.find({
  "signup_time": {
    $gt: new Date(Date.now() - 24*60*60 * 1000)
  }
})

ref - https://stateofprogress.blog/choose-sql-d017cfc08870

Convert MySQL Queries to MongoDB Syntax http://www.querymongo.com/

origin - http://www.pipiscrew.com/?p=7314 sql-vs-mongodb

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags