Skip to content

Instantly share code, notes, and snippets.

@IamTechknow
Last active November 20, 2018 08:22
Show Gist options
  • Save IamTechknow/3fb014d8864e03e38e88162b84331d86 to your computer and use it in GitHub Desktop.
Save IamTechknow/3fb014d8864e03e38e88162b84331d86 to your computer and use it in GitHub Desktop.
Here, my database queries are prepend with >, and the response will be on the line after.
PostgreSQL:
> SELECT * FROM campaigns WHERE id = 5255555;
id | campaign | description | author | _user | country | pledged | goal | backers | enddate | _type
5255555 | Ergonomic Concrete Gloves | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 227508 | 143131 | 204 | 1546646400 | 12
> SELECT * FROM campaigns WHERE _user = 'Kirsten67' LIMIT 10;
id | campaign | description | author | _user | country | pledged | goal | backers | enddate | _type
---------+----------------------------+----------------------+---------------+-----------+---------+---------+--------+---------+------------+-------
5255501 | Intelligent Steel Soap | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 140584 | 141892 | 21 | 1546905600 | 5
5255577 | Fantastic Plastic Chicken | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 27100 | 74909 | 98 | 1546128000 | 14
5255578 | Fantastic Wooden Shirt | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 11764 | 98120 | 420 | 1549497600 | 4
5255579 | Handmade Fresh Salad | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 22845 | 124475 | 425 | 1544486400 | 2
5255580 | Awesome Wooden Pizza | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 59695 | 99833 | 367 | 1544227200 | 8
5255581 | Refined Wooden Pizza | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 44807 | 61878 | 12 | 1550361600 | 1
5255582 | Incredible Plastic Chips | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 176900 | 145415 | 382 | 1549411200 | 7
5255583 | Refined Rubber Chips | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 110404 | 77828 | 155 | 1550880000 | 3
5255584 | Sleek Metal Soap | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 48732 | 128615 | 417 | 1550361600 | 8
5255585 | Incredible Rubber Keyboard | Campaign description | Kirsten Hayes | Kirsten67 | 3 | 144370 | 59165 | 115 | 1548288000 | 8
MongoDB:
> db.campaigns.find(ObjectId('5bf0b61f5bdbef8dfd5003b3'))
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b3"), "campaign" : "Licensed Wooden Keyboard", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 96828, "goal" : 124193, "backers" : 283, "endDate" : 1548806400, "_type" : 6 }
> db.campaigns.find({user : "Adriana85"}).limit(10);
{ "_id" : ObjectId('5bf0b61f5bdbef8dfd5003b3'), "campaign" : "Licensed Wooden Keyboard", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 96828, "goal" : 124193, "backers" : 283, "endDate" : 1548806400, "_type" : 6 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b4"), "campaign" : "Refined Plastic Chair", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 40902, "goal" : 51162, "backers" :497, "endDate" : 1551139200, "_type" : 3 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b5"), "campaign" : "Generic Frozen Sausages", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 50249, "goal" : 73079, "backers": 490, "endDate" : 1547251200, "_type" : 10 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b6"), "campaign" : "Licensed Fresh Cheese", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 4297, "goal" : 77726, "backers" : 51, "endDate" : 1545868800, "_type" : 4 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b7"), "campaign" : "Handmade Granite Fish", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 120455, "goal" : 64719, "backers" : 46, "endDate" : 1548201600, "_type" : 1 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b8"), "campaign" : "Incredible Plastic Shirt", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 79857, "goal" : 130604, "backers" : 6, "endDate" : 1549497600, "_type" : 11 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003b9"), "campaign" : "Practical Soft Salad", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 161464, "goal" : 71331, "backers" :381, "endDate" : 1546473600, "_type" : 3 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003ba"), "campaign" : "Refined Concrete Sausages", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 136952, "goal" : 93225, "backers" : 54, "endDate" : 1544313600, "_type" : 2 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003bb"), "campaign" : "Licensed Granite Pants", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 177196, "goal" : 80162, "backers": 146, "endDate" : 1551225600, "_type" : 5 }
{ "_id" : ObjectId("5bf0b61f5bdbef8dfd5003bc"), "campaign" : "Small Rubber Car", "description" : "Campaign description", "author" : "Adriana Murphy", "user" : "Adriana85", "country" : 20, "pledged" : 135003, "goal" : 124827, "backers" : 252, "endDate" : 1550620800, "_type" : 9 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment