mongoosejs / mquery

Expressive MongoDB query builder
MIT License
478 stars 73 forks source link

mquery for Titanium Mobile Framework #56

Closed gopalakrishnan-subramani closed 8 years ago

gopalakrishnan-subramani commented 9 years ago

Having hard-time to bring mquery into Appcelerator Titanium. It has many dependencies. We liked mquery, it perfectly fits our needs.

We have 3 use cases.

  1. Use with Nodejs environment, we have queries stored in DB in proprietory format (expressions), we use mquery to generate mongo query (100% find query). No issues with that.
  2. Use with Appcelerator Titanium client side native apps, we don't use direct Mongo Connection at mobile apps, we use NeDB, a lightweight Javascript query based Mongo engine for mobile apps. NeDB does respect many mongo find query options. We are working on bringing mquery dependent libraries, having difficulties with their dependencies.
  3. Mobile online. Use mquery to generate the find query, convert to JSON, pass to server, get the result through JSON API. No Issues.

If anyone help us or make us to understand to make a bundled mquery package to integrate into mobile apps, that would be great. Also I am hoping that mquery would continue its path with consideration our use cases, abstract the collection from direct mongo reference.

aheckmann commented 9 years ago

I'm happy to make this more flexible. A pull request might be the best way to move this forward.

— Sent from Mailbox

On Mon, Jan 26, 2015 at 8:33 AM, Gopalakrishnan Subramani notifications@github.com wrote:

Having hard-time to bring mquery into Appcelerator Titanium. It has many dependencies. We liked mquery, it perfectly fits our needs. We have 3 use cases.

  1. Use with Nodejs environment, we have queries stored in DB in proprietory format (expressions), we use mquery to generate mongo query (100% find query). No issues with that.
  2. Use with Appcelerator Titanium client side native apps, we don't use direct Mongo Connection at mobile apps, we use NeDB, a lightweight Javascript query based Mongo engine for mobile apps. NeDB does respect many mongo find query options. We are working on bringing mquery dependent libraries, having difficulties with their dependencies.
  3. Mobile online. Use mquery to generate the find query, convert to JSON, pass to server, get the result through JSON API. No Issues. If anyone help us or make us to understand to make a bundled mquery package to integrate into mobile apps, that would be great. Also I am hoping that mquery would continue its path with consideration our use cases, abstract the collection from direct mongo reference.

    Reply to this email directly or view it on GitHub: https://github.com/aheckmann/mquery/issues/56

gopalakrishnan-subramani commented 9 years ago

Made it compiled in Titanium, but disabled many modules from loading, not recommended for pull request now.

May be you can comment on below observations.

  1. package 'util' was used only one time in mquery.js for string format, the below can be achieved via "Invalid GeoJSON specified for %s".format(type). Do you have long term plan for util module?

    // GeoJSON? if (val.center.type != 'Point' || !Array.isArray(val.center.coordinates)) { throw new Error(util.format("Invalid GeoJSON specified for %s", type)); }

  2. setImmediate and use of process.tick was not supported by Titanium, I used shim from https://raw.githubusercontent.com/jphpsf/setImmediate-shim-demo/master/setImmediate.js this worked. We have no plan to use this, as I mentioned, we don't execute query via mquery instead we capture the query strings as JSON.
  3. Disabled Promise (bluebird), disabled permission, disabled assert and debug (however some of these modules can be included), I will look into resolving their dependencies later this week.

Now I could generate and capture the query string for our need. I wrote my own collection with find method. I will post my updates.

Thanks for great module.