id
Uniquely identify an instance or raw instance data.
connection.id(instance)
Returns the instance id as determined by queryLogic's id values.
Parameters
- instance
{Instance|Object}
:An instance or raw properties for an instance.
Returns
{String|Number}
:
A string or number uniquely representing instance
.
Use
Many behaviors, such as the constructor/store, need to have a unique identifier for an
instance or instance data. This connection.id
method should return that.
Typically, an item's id is a simply property value on the object. For example, "Todo" data might look like:
{_id: 5, name: "do the dishes"}
In this case, queryLogic's id
property should be set to "_id":
import QueryLogic from "can-query-logic";
var queryLogic = new QueryLogic({
identity: ["_id"]
});
connect([...],{queryLogic: queryLogic});