Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. start mongo
  2. cd to mongo bin directory
  3. mongod
  4. in another cmd window mongo bin directory open mongo shell
  5. mongo
  6. inport a json file in mongo bin directory
  7. mongoimport --db test --collection restaurants --drop --file c://Mongosets//primer-dataset.json
  8.  
  9. select db
  10. use test //test is db name
  11. insert new record from shell
  12. db.restaurants.insert(
  13. {
  14. "address" : {
  15. "street" : "2 Avenue",
  16. "zipcode" : "10075",
  17. "building" : "1480",
  18. "coord" : [ -73.9557413, 40.7720266 ],
  19. },
  20. "borough" : "Manhattan",
  21. "cuisine" : "Italian",
  22. "grades" : [
  23. {
  24. "date" : ISODate("2014-10-01T00:00:00Z"),
  25. "grade" : "A",
  26. "score" : 11
  27. },
  28. {
  29. "date" : ISODate("2014-01-16T00:00:00Z"),
  30. "grade" : "B",
  31. "score" : 17
  32. }
  33. ],
  34. "name" : "Vella",
  35. "restaurant_id" : "41704620"
  36. }
  37. )
  38.  
  39. Find all the records
  40. db.restaurants.find()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement