Giter VIP home page Giter VIP logo

rethink-livedata's Introduction

RethinkDB for Meteor [currently broken]

Meteor Smart Package providing RethinkDB support for Meteor

  • Write wonderful ReQL syntax on both client (Minirethink) and server (RethinkDB) side
  • Perform queries faster* by avoiding database polling and the LiveResultsSet
  • Don't write Mongo syntax (again, ever.)

Installation

Install RethinkDB from Atmosphere

    $mrt add rethink-live-data

Install From Git (If you are not using Meteorite)

    mkdir -p packages
    git submodule add https://github.com/tuhinc/rethink-livedata.git packages/rethink-livedata

Usage

Tables

Replace Meteor.Collection with Meteor.Table.

// old code
Posts = new Meteor.Collection('posts');

// with rethink-live-data
Posts = new Meteor.Table('posts');

On the client side, create an instance of Minirethink to use ReQL syntax instead of Mongo syntax.

// instantiate Minirethink
var r = new Minirethink();

// interact with database using ReQL syntax
r.table('posts').get('username').run(callback);

Continue to use publish and subscribe as you normally would. (rethink-live-data does not currently support autopublish)

// server: publish the posts table.
Meteor.publish('posts', function () {
return r.table('posts').run(callback);
});

// client: subscribe to the posts table
Meteor.subscribe('posts');

// client will queue incoming post records until ...
Posts = new Meteor.Table('posts');

Cursors

Currently provides support for each, map, fetch, count, and hasNext

each

Lazily iterate over the result set one element at a time.

cursor.each(callback[, onFinished])

map

Transform each element of the sequence by applying the given mapping function.

cursor.map(mappingFunction)  array

fetch

Returns an array of all documents in the cursor

cursor.fetch()  array    

count

Transform each element of the sequence by applying the given mapping function.

cursor.count()  integer

hasNext

Check if there are more elements in the cursor

cursor.hasNext()  bool

Compatibility

  • Currently does not support autopublish -- publish and subscribe functions must be used!

Scalability

Disclaimers:

  1. This is a work-in-progress. Full functionality has not yet been implemented. There are definitely bugs! :)
    • this claim has not been tested

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.