Meteor REST driver - meteor

Is it possible for Meteor to use RESTful db driver instead of Mongodb?
I have started studying Meteor and I want to use it in a project I am working on. The problem is that this project uses MySQL. I want to keep using Mondb syntax for CRUD operations but instead of using the Mongodb database I want to use RESTful for a PHP web service.
For example, when I do: Albums.find({'name': 'Atom heart mother'}) I want Meteor makes a GET request to http://server/web_service.php/albums/?query={'name': 'Atom heart mother'}
I don't care if Meteor is still using mondodb for the session, app state and some other stuff.
Thank you people, and sorry if my english sucks

For the moment, Meteor can't be used with SQL directly - the best try at this so far is the meteor-sql smart package, but it's been inactive for a good while. And the meteor roadmap doesn't make SQL integration a priority.
The meteor iron-router does allow server-side routing, so you could potentially link your Mongo calls to server routes this way... but wiring this up to Meteor's real-time data might be tricky.

Related

Meteor API vs external API

Basically I want a real time application (Meteor) so I can see a real time dashboard
This back-end (Meteor server) would eventually be hit by some external application via API to get data from the DB (example: mobile App) or add some entries (not from the front-end)
My question is : What is better: create a Meteor API OR create an external server (ExpressJS) that would be connected to Meteor DB?
Meteor is great for building Full Stack apps (front end + back end), and has native support for MongoDB, which together are powerful for building real-time apps (using DDP for example) relatively easily.
Express is an MVC Framework built in Javascript and powered by Node. You will usually have to consider more technologies and frameworks when using Express (MEAN stack), which has a steeper learning curve when compared with Meteor.
Given that you're intending to develop a Full Stack app, building an API using Meteor is more straightforward. As suggested by Mikkel, restivus would be the Meteor package to consider for building your REST service.
If complexity is not a hurdle, using Express is likely to yield to a more efficient solution.
You can integrate express with Meteor - probably a better solution, because you only need one server.
There are Meteor packages for creating REST API's that work well https://atmospherejs.com/nimble
Another approach (my preference) would be to use GraphQL server with Meteor. Apollo Client and Server were developed by the Meteor Development Group (MDG) https://github.com/abhiaiyer91/sample-graphql-meteor-server

Does Sails.js or Meteor.js work with ArangoDB or OrientDB?

I'm planning to work on a social site and I would like to leverage both a document and graph database for all of the desired features. Is there a way to get Meteor.js or Sail.js (or any better) to work with ArangoDB or OrientDB? Or should I just stick with the bundled MongoDB and integrate something like allegrograph DB?
Sails.js has support for both of the databases you mention:
https://www.npmjs.com/package/sails-orientdb
https://github.com/rosmo/sails-arangodb
In addition to MongoDB, Postgres, and dozens of others.
Sails.js is a classic mvc client-server web application framwork, basically its ruby on rails implemented for node.js + webscockets, so mostly all you need to make it work with any backend database is make changes to the orm.
Meteor is a very different beast, it is a very opinionated realtime end to end web framework including client server and database, by behing very very opinionated it solves many of the common issues in realtime application, where you need to implement a mechanisms for very quickly updating all your clients of each others actions and take care of things like latency compensation, data collision resolution, and real time client version managment, This is implemented by using web sockets and the mongoDB's write ahead logging for triggres of data updates, making meteor somewhat coupled with mongo.
But you can make orientdb work pretty well with meteor using the new orientDB live query api. It is a pubsub implementation for query results, and can be used for efficent updates pushed from the db through the server directly to the client with very little overhead on the server. This is far from production ready and only currently works on the orient db 2.1 rc5 version.
I have implemented a small meteor demo application as an example https://github.com/imdark/meteor-orientdb-demo
Please check on Meteorpedia the Alternative Database Post, they mention neo4j-livedata and minineo4j.
Here is the Atmosphere package: ostrio:neo4jdriver
Is there a specific economic or technological reason why you consider not to use the very well integrated mongoDB as the database of choice?
In addition to Travis answer I also recommend waterline-orientdb for Sails.js.

ActiveResource for Meteor

Would it make sense to use Meteor when you want to replace MongoDB with a solution like ActiveResource for Rails? I'm still figuring out if this is doable and makes sense.
Basically what I want to do is couple Meteor to an external API, but still keep it's features like latency compensation, live updates etc. But I can't seem to find any examples, other than: implementing the DDP protocol. But I don't want Meteor to have direct access to MongoDB (or whatever DB is behind the API). Which would mean it should be built into the Meteor collection.
Any tips?

MeteorJS Alternatives: Latency Compensation Frameworks and Libraries?

Effort:
I am building a word game based on a chat web-client where I need to make a server call on input chat text to validate it before broadcasting on the chat.
I am aware of Meteor providing latency compensation out of the box. But given its still in "early preview" makes me seek other alternatives.
What I tried:
Unfortunately my web search for "latency compensation framework library" doesn't yield anything other than Meteor (including non-personalized results).
Question: Are there any other alternatives that provide latency compensation -or- can make the job easier? I am hoping other developers might have encountered something useful/relevant.
Although Meteor is in 'early preview', its code is very close production ready and a lot of startups and other early adopters are using it for production-level code. You aren't going to find anything that gives you wings like Meteor because no such alternative exists.
As a hardcore Meteor convert and someone who's used many other frameworks, I recommend you to just try Meteor out. As they say, it only takes a weekend for you to build an app in Meteor and decide whether it's right for you.
Having said that, I will attempt to answer the question and list the distant-second alternatives to Meteor that you probably won't want to use:
Derby
Sails
What you're seeing right now in the various real-time full-stack Javascript web frameworks is the future of Web development, cutting down dozens of people and thousands of man-hours of work needed to develop a software project. There are some fast boats sailing that are leaving server-side rendering behind, and you should probably just get in one of them and get going.
RethinkDB uses term 'latency compensation'.
I've also tried to gather per-feature alternatives to Meteor
Meteor is a really cool framework. you can build the complex data driven application very easily using meteor.
But, this framework currently supports only the MongoDB as back-end database.
I have recently created full stack framework called Nooljs which is similar to the Meteor. Now I have open sourced it. It support all the database connections including MySql, ms-sql, and MongoDB. The complex data driven application can be created easily using this framework.
This has been developed using well known existing framework such as Angularjs, Node, express-js, and socket-io.
Easy to build complex data driven JavaScript applications with minimum coding.
Support multiple data connections suck as Ms-sql, MySQL, PostgreSQL, and Mondodb.
Real time framework build top of Express-js and Socket-io
The client side is powered by the Angularjs.
The layout can be build using the Angularjs tags and elements.
Modularized layout to simplify the complex web pages.
Can be mixed both Express-js and Socket-io

Feasability of having another process write to the mongo database used in a Meteor application?

I've got an application where I'm populating a Mongo database. That code is not super easily portable to Meteor, so that I'm doing is running that code in a separate process and writing data to Mongo collections.
In my Meteor application, I point it at that shared Mongo instead of the default instance. The application works reasonably well, but the updates don't seem to happen as fast as I would have expected. When I write a value to Mongo from my external process, it seems to take a while before my client refreshes to show updated content. There is about 7MB of total data in my Mongo database.
Is this approach to share a Mongo and write to it from an external process feasible or is it not advised?
Thanks!
Eric.
As MongoDB doesn't have any live-queries Meteor polls for changes it missed every 10 seconds. Therefore it can take up to 10 seconds until changes are noticed by Meteor.
About the approach in general: it is fine to do so. If you need faster updates you might need to use an other approach or trigger Meteor to update itself (not sure if this is possible at all). Also note that meteor might not support every MongoDB feature yet.
Further readings
Multi-Server architecture and concurrency
Talk at the Dev-Workshop: How Meteor is Scaling Meteor

Resources