LoopBack’s built-in memory connector enables you to test your application without connecting to an actual persistent data source such as a database.Although the memory connector is very well tested it is not suitable for production.

The memory connector supports:

  • Geo-filtering when using the operation with an attached model.See for more information on geo-filtering.

Important: The memory connector is designed for development and testing of a single-process application without setting up a database. It cannot be used in a cluster as the worker processes will have their own isolated data not shared in the cluster.

You can persist data between application restarts using the property. See Data persistence for more information.

/server/datasources.json

Use the to add a new memory data source to your application.

Important: If you specify the file property, the connector will save data there that will persist when you restart the application.Otherwise, the memory connector does not persist data after an application stops.

By default, data in the memory connector are transient. When an application using the memory connector exits, all model instances are lost.To maintain data across application restarts, specify a JSON file in which to store the data with the property when creating the data source.

server/datasources.json

You can also set the persistence file in a boot script; for example:

server/boot/script.js

When the application exits, the memory connector will then store data in the file, and when it restarts will load the saved data from that file.