Skip to content
On this page
v2.0.0-pre.18

Model Functions

Data Modeling is the most important feature of Feathers-Pinia. There are two Model Function types we can use to model our data:

  • BaseModel provides data storage, retrieval, temp records, and clone/commit methods.
  • FeathersModel builds on top of BaseModel and adds Feathers service connectivity. It includes all functionality formerly included in the BaseModel class (from previous releases).

The new BaseModel allows using the same API for all types of data, not just the data connected to a Feathers API service. It even includes the findInStore API for filtering local data with the Feathers Query Syntax as well as custom operators like $iLike from SQL databases or $regex from MongoDB. Compare the static store interfaces.

Both Model Functions come with their own stores which do not require Feathers-Pinia. You can overwrite the internal store by calling Model.setStore(myPiniaStore). Find a comparison of store properties further down this page.

Which Model Should I Use?

Compare Static Properties

Use the following tabs to compare the properties found directly on BaseModels vs on FeathersModels.

js
store
setStore()
findInStore()
countInStore()
getFromStore()
addToStore()
removeFromStore()
associations
js
store
setStore()
findInStore()
countInStore()
getFromStore()
addToStore()
removeFromStore()
associations

// FeathersModel adds
find()
count()
get()
create()
update()
patch()
remove()
useFind()
useGet()
useGetOnce()
useFindWatched()
useGetWatched()

Compare Default Stores

View the comparison of BaseModel stores to FeathersModel stores.

Many thanks go to the Vue, Vuex, Pinia, and FeathersJS communities for keeping software development FUN!