Advertisement
funtique

NoSQL - TP2

Feb 19th, 2024 (edited)
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 3.04 KB | None | 0 0
  1. NoSQL - TP2
  2. ThΓ©o LEBLANC, ESIEA TD48
  3.  
  4. 1. db.Exo.find({})
  5.  
  6. 2. db.Exo.find({}, {restaurant_id: 1, name: 1, borough: 1, cuisine: 1})
  7.  
  8. 3. db.Exo.find({}, {restaurant_id: 1, name: 1, borough: 1, cuisine: 1, _id: 0})
  9.  
  10. 4. db.Exo.find({}, {'restaurant_id': 1, 'name': 1, 'borough': 1, 'address.zipcode': 1, '_id': 0})
  11.  
  12. 5. db.Exo.find({'borough': 'Bronx'})
  13.  
  14. 6. db.Exo.find({'borough': 'Bronx'}).LIMIT(5)
  15.  
  16. 7. db.Exo.find({'borough': 'Bronx'}).skip(5).LIMIT(5)
  17.  
  18. 8. db.Exo.find({'grades.score': {$gt: 90}})
  19.  
  20. 9. db.Exo.find({'grades.score': {$gt: 80, $lt: 100}})
  21.  
  22. 10. db.Exo.find({'address.coord.0': {$lt: -95.754168}})
  23.  
  24. 11. db.Exo.find({$and: [{"cuisine": { $ne: "American" }}, {"grades.score": { $gt: 70 }}, {"address.coord.0": { $lt: -65.754168 }}]})
  25.  
  26. 12. db.Exo.find({'cuisine': {$ne: 'American'}, 'grades.score': {$gt: 70}, 'address.coord.0': {$lt: -65.754168}})
  27.  
  28. 13. db.Exo.find({'cuisine': {$ne: 'American '}, 'grades.grade': 'A', 'borough': {$ne: 'Brooklyn'}}).sort({'cuisine': -1})
  29.  
  30. 14. db.Exo.find({'name': /^Wil/}, {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  31.  
  32. 15. db.Exo.find({'name': /ces$/}, {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  33.  
  34. 16. db.Exo.find({'name': /Reg/}, {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  35.  
  36. 17. db.Exo.find({'borough': 'Bronx', '$or': [{'cuisine': 'American'}, {'cuisine': 'Chinese'}]})
  37.  
  38. 18. db.Exo.find({'borough': {$in: ['Staten Island', 'Queens', 'Bronx', 'Brooklyn']}},
  39.     {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  40.  
  41. 19. db.Exo.find({'borough': {$nin: ['Staten Island', 'Queens', 'Bronx', 'Brooklyn']}},
  42.     {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  43.  
  44. 20. db.Exo.find({'grades.score': {$lte: 10}},
  45.     {'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  46.  
  47. 21. db.Exo.find({$or: [{cuisine: {$nin: ['American', 'Chinese']}},
  48.     {name: /^Wil/}]},{'restaurant_id': 1, 'name': 1, 'borough': 1, 'cuisine': 1, '_id': 0})
  49.  
  50. 22. db.Exo.find({grades: {$elemMatch: {grade: 'A', score: 11, DATE: ISODate("2014-08-11T00:00:00Z")}}},
  51.     {'restaurant_id': 1, 'name': 1, 'grades': 1, '_id': 0})
  52.  
  53. 23. db.Exo.find({"grades.1.grade": "A","grades.1.score": 9,"grades.1.date": ISODate("2014-08-11T00:00:00Z")},
  54.     {'restaurant_id': 1, 'name': 1, 'grades': 1, '_id': 0})
  55.  
  56. 24. db.Exo.find({'address.coord.1': {$gt: 42, $lte: 52}},
  57.     {'restaurant_id': 1, 'name': 1, 'address': 1, '_id': 0})
  58.  
  59. 25. db.Exo.find({}).sort({'name': 1})
  60.  
  61. 26. db.Exo.find({}).sort({'name': -1})
  62.  
  63. 27. db.Exo.find({}).sort({'cuisine': 1, 'borough': -1})
  64.  
  65. 28. db.Exo.find({'address.street': {$exists: TRUE}})
  66.  
  67. 29. db.tp2.find({ "address.coord": { $type: "double" } })
  68.  
  69. 30. db.Exo.find({"grades.score": {$mod: [7, 0]}},
  70.     {'restaurant_id': 1, 'name': 1, 'grades': 1, '_id': 0})
  71.  
  72. 31. db.Exo.find({'name': /mon/},
  73.     {'name': 1, 'borough': 1, 'address.coord': 1, 'cuisine': 1, '_id': 0})
  74.  
  75. 32. db.Exo.find({'name': /^Mad/},
  76.     {'name': 1, 'borough': 1, 'address.coord': 1, 'cuisine': 1, '_id': 0})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement