Skip to content

Instantly share code, notes, and snippets.

@Bilguun132
Created February 23, 2019 18:52
Show Gist options
  • Select an option

  • Save Bilguun132/fd2bdaf11d496ffc231d28c1578c84c0 to your computer and use it in GitHub Desktop.

Select an option

Save Bilguun132/fd2bdaf11d496ffc231d28c1578c84c0 to your computer and use it in GitHub Desktop.
MongoDemo-Tutorial-QueryOperations
Connected to MongoDB...
{ genre: [ 'action, adventure, fantasy' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c218,
name: 'Avengers',
director: 'Joss Whedon',
price: 10,
__v: 0 }
{ genre: [ 'animation, action, adventure' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c219,
name: 'Spider-Man: Into the Spider-Verse',
director: 'Peter Ramsey',
price: 15,
__v: 0 }
getting all movies
[ { genre: [ 'action, adventure, fantasy' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c218,
name: 'Avengers',
director: 'Joss Whedon',
price: 10,
__v: 0 },
{ genre: [ 'animation, action, adventure' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c219,
name: 'Spider-Man: Into the Spider-Verse',
director: 'Peter Ramsey',
price: 15,
__v: 0 } ]
getting movies filtered
[ { genre: [ 'action, adventure, fantasy' ], name: 'Avengers' } ]
getting all movies count
2
getting movies with regex expressions
[ { genre: [ 'animation, action, adventure' ],
releaseDate: 2019-02-23T18:50:55.357Z,
_id: 5c71960ff3e891294bf8c219,
name: 'Spider-Man: Into the Spider-Verse',
director: 'Peter Ramsey',
price: 15,
__v: 0 } ]
getting movies with comparison query
[ { genre: [ 'action, adventure, fantasy' ], name: 'Avengers' } ]
getting with logical query
[ { genre: [ 'action, adventure, fantasy' ], name: 'Avengers' },
{ genre: [ 'animation, action, adventure' ],
name: 'Spider-Man: Into the Spider-Verse' } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment