Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- start mongo
- cd to mongo bin directory
- mongod
- in another cmd window mongo bin directory open mongo shell
- mongo
- inport a json file in mongo bin directory
- mongoimport --db test --collection restaurants --drop --file c://Mongosets//primer-dataset.json
- select db
- use test //test is db name
- insert new record from shell
- db.restaurants.insert(
- {
- "address" : {
- "street" : "2 Avenue",
- "zipcode" : "10075",
- "building" : "1480",
- "coord" : [ -73.9557413, 40.7720266 ],
- },
- "borough" : "Manhattan",
- "cuisine" : "Italian",
- "grades" : [
- {
- "date" : ISODate("2014-10-01T00:00:00Z"),
- "grade" : "A",
- "score" : 11
- },
- {
- "date" : ISODate("2014-01-16T00:00:00Z"),
- "grade" : "B",
- "score" : 17
- }
- ],
- "name" : "Vella",
- "restaurant_id" : "41704620"
- }
- )
- Find all the records
- db.restaurants.find()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement