According to the documentation for using Mongoose in the browser, it shows using a CDN stored copy of mongoose.js.
I need to do development offline, so want to store a local copy of mongoose.js. Is this file available anywhere, other than the CDN. It doesn't appear to be part of the standard NPM distribution. It would be nice if was available on Bower, for example.
I'd like to be able to do schema validation on the client side (Angular), but can't find how to hook into this.
We explicitly exclude mongoose.js in .npmignore
, reason for that is performance, so it won't be in your node_modules
. Bower is a pretty good suggestion. For now, if you want a local copy, the easiest way would be to just download a copy from the CDN. If you're using browserify, webpack, etc. you can also just require()
in mongoose.
Thanks, I tried Browserify today and got a missing Kerberos module error, either trying to build from lib/browser.js, or from my app.js that contained a require('mongoose');
I gave up and downloaded the release zip and took mongoose.js from there.
That certainly needs better documentation, the docs and related blogs on browser side all assume using the CDN.
Are you worried about performance in the browser, or of NPM? I now have it working and performance seems ok, even on per keystroke validations.
Cheers
Dave
On 1 Jun 2015, at 18:13, Valeri Karpov [email protected] wrote:
We explicitly exclude mongoose.js in .npmignore, reason for that is performance, so it won't be in your node_modules. Bower is a pretty good suggestion. For now, if you want a local copy, the easiest way would be to just download a copy from the CDN. If you're using browserify, webpack, etc. you can also just require() in mongoose.
—
Reply to this email directly or view it on GitHub.
The concern was performance of npm install
rather than performance in the browser. Admittedly not a huge concern but we didn't really envision people using npm to pull down the browser component. Thanks for pointing out the kerberos issue, I'll see if I can repro that.
browserify
-ing MongooseWould be great to have a "mongoose-browser" NPM module.
require('mongoose');
or require('mongoose/browser');
is the same thing.
great thanks
I don't think this issue is closed. mongoose.js is still not available through npm (as many client side libraries now are). I should not have to install browserify and compile it myself. It should come as part of the standard package.
i would love to use bower in mongoose, they say bower is not used anymore but still bower is the biggest, like windows vs linux... i use both though, but Bower is why not it is used??? The biggest client library.
Is this no longer supported? Trying the cloudfront URLs and substituting in any recent versions of mongoose, returns a 404. And since it is not packaged in NPM, there is no way to get a matching version. It can be very useful to reuse the schemas for client side validation in angular etc.
@caoimhinb unfortunately our process for uploading to s3 has been broken for a while and we never got around to fixing it, and we've formally dropped support for the pre-built bundle in 5.0.0-rc0 in favor of improving support for bundlers like webpack and browserify. Which 4.x version do you need on cloudfront? We'll be happy to upload it manually.
Thanks - I am rethinking my client-side (ionic/angular) implementation anyway, and mongoose schema validation is probably overkill for my needs. But I think in future this would be a useful package to have on npm, especially for rapid prototyping on the client.
(FYI I was following this guide: http://thecodebarbarian.com/2015/02/20/better-angularjs-form-validation-with-mongoose )
@caoimhinb what will you use as an alternative to mongoose schema validation, and what package are you talking about?
Most helpful comment
I don't think this issue is closed. mongoose.js is still not available through npm (as many client side libraries now are). I should not have to install browserify and compile it myself. It should come as part of the standard package.