jsonapi-store-mongodb
v2.0.0
Published
MongoDB data store for jsonapi-server.
Downloads
29
Readme
jsonapi-store-mongodb
jsonapi-store-mongodb
is a MongoDB backed data store for jsonapi-server
.
This project conforms to the specification laid out in the jsonapi-server handler documentation.
Usage
var MongoStore = require("jsonapi-store-mongodb");
jsonApi.define({
resource: "comments",
handlers: new MongoStore({
url: "mongodb://localhost:27017/jsonapi",
})
});
Features
- Search, Find, Create, Delete, Update
- Efficient lookups via appropriate indexes
- Database layer filtering, pagination and sorting
Getting to Production
Getting this data store to production is really simple:
- Bring up your MongoDB stack.
- Create any indexes you may need (this is optional, this module will automatically ensure indexes exist on relationships, however you might want to add an index to an attribute you intend on querying aggressively).
- Deploy your code.
- Celebrate.
When making schema changes, deploy away and carry on. If the changes aren't backwards compatible, you may want to run a job to ensure all old (existing) records conform to the new schema. If they don't conform to the new schema, they will be dropped by jsonapi-server's validation layer.