Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents

Table of Contents

Child pages

Child pages (Children Display)


...

  • Get all records from a particular collection once you're switched to a particular db
    • 'db.<collection_name>.find()'
  • Check if a field contains a string
    • db.getCollection('collection_name').find({"Party1": {$regex : ".*similarly situated.*"}})
  • Find records by non-existence of a field:
    • db.mycollection.find({ "price" : { "$exists" : false } })
  • Find a record by its id:
    • db.collection_name.find({"_id": ObjectId("587862a88362593254464c69")})
      • So you can find it by the id's string value, but you need to wrap the string with ObjectId()

Neo4j

General

Tutorials

Tools

Pros and cons of graph databases

PostgreSQL

Websites

Tutorials

Extensions

  • PostGIS
    • This was one of the major reasons Krieger and Systrom went with Postgres over MySQL. (Source)

Books

Snippets

  • Get the number of rows in all tables in a database.
    • SELECT schemaname,relname,n_live_tup
      FROM pg_stat_user_tables
      ORDER BY n_live_tup DESC;