Querying Data

  • These objects are returned when using find-like functionality on DittoCollections.

    They allow chaining of further query-related functions to do things like add a limit to the number of documents you want returned or specify how you want the documents to be sorted and ordered. You can either call exec on the object to get an array of DittoDocuments as an immediate return value, or you can establish either a live query or a subscription, which both work over time.

    A live query, established by calling observeLocal, will notify you every time there’s an update to a document that matches the query you provided in the preceding find-like call.

    A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about documents that match the query you provided in the preceding find-like call.

    Typically, an app would set up a subscribe in some part of the application which is long-lived to ensure the device receives updates from the mesh. These updates will be automatically received and written into the local store. Elsewhere, where you need to use this data, an observeLocal can be used to notify you of the data, and all subsequent changes to the data.

    Update and remove functionality is also exposed through this object.

    See more
  • These objects are returned when using findByID functionality on DittoCollections.

    You can either call exec on the object to get an immediate return value, or you can establish either a live query or a subscription, which both work over time.

    A live query, established by calling observeLocal, will notify you every time there’s an update to the document with the ID you provided in the preceding findByID call.

    A subscription, established by calling subscribe, will act as a signal to other peers that you would like to receive updates from them about the document with the ID you provided in the preceding findByID call.

    Typically, an app would set up a subscribe in some part of the application which is long-lived to ensure the device receives updates from the mesh. These updates will be automatically received and written into the local store. Elsewhere, where you need to use this data, an observeLocal can be used to notify you of the data, and all subsequent changes to the data.

    Update and remove functionality is also exposed through this object.

    See more
  • Describes the direction when sorting a query.

    See more