Skip to content

Instantly share code, notes, and snippets.

@cn007b
Created August 14, 2018 11:25
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 cn007b/42129d89fa3c1349c54032af38a43c70 to your computer and use it in GitHub Desktop.
Save cn007b/42129d89fa3c1349c54032af38a43c70 to your computer and use it in GitHub Desktop.
PostgreSQL vs MongoDB - mongo query
db.file_storage.aggregate([
{$match: {"count": {$gt: 0}}},
{$unwind: "$files"},
{$project: {_id: 1, sha1: 1, "name": "$files.name"}},
{$sort: {_id: -1, "name": 1}},
{$skip : 1000},
{$limit : 10},
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment