masylum / mongolia Goto Github PK
View Code? Open in Web Editor NEWFlexible non-magical layer for the nodejs MongoDB driver
Flexible non-magical layer for the nodejs MongoDB driver
Is this using some non-NPM fork/branch of the mongodb driver?
Error: No satisfying version found for 'mongodb'@'>=0.8.0'
Hi guys.
I found a bug on the file mongolia/lib/helpers/update_document.js, line 85. If the document informated (VALIDATOR.update, line 84) don't has no one key, then will throw the error {"message":"Cannot read property '0' of undefined"}. Solution is simple:
instead of
, special_op = keys[0][0] === '$'
use
, special_op = keys[0] && keys[0][0] === '$'
Why this problem? Because I sent an object without keys ({}) to insert in the mongodb.
Sorry the english.
when running tests with latest mongo, integration_tests fail:
» 12 asserts ✿ integration/integration_test.js : Insert documents with before/afterInsert hooks => ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Update embedded documents => ✗ => AssertionError: 1 == at Object.equal (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/node_modules/testosterone/lib/testosterone.js:47:39) at /cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/test/integration/integration_test.js:83:20 at Collection.update (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongodb/lib/mongodb/collection.js:370:12) at /cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/lib/model.js:360:18 at [object Object].collection (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongodb/lib/mongodb/db.js:161:14) at Object.getCollection (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/lib/model.js:29:8) at Object.updateEmbeddedDocument (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/lib/model.js:355:11) at /cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongolia/test/integration/integration_test.js:82:16 at [object Object]. (/cygdrive/c/Users/vincent/Documents/devel/test/node_modules/mongodb/lib/mongodb/collection.js:687:5) at [object Object].emit (events.js:67:17)
Hello, while I researching nodejs platform I accidentally found out your project "Mongolia". And I do believe that you aware of there's a whole county and the nation that named "Mongolian". I respect technological work and there's a meaning regarding MongoDB. But as a Mongolian, It's not acceptable to choose a such name. And it's possible that your singular naming will create confusion and misconception. I sincerely request to change the name of your project.
In order to save disk space, sometimes people need to name their fields with obscure names.
I think its a good idea to let users define alias for their field names.
MODEL.alias = {
created_at: 'ca',
name: 'n'
};
foo.mongo('findOne', {name: 'bar'}, function (err, doc) {
console.log(doc.name); // => 'bar'
console.log(doc.created_at); // => 'Jun 12, 2011 ...'
console.log(doc.n); // => 'bar'
});
This feature if used will add a little overhead to setup the setters/getters on returning elements.
Add missing tests
Hello guys, the namespce is being ignored on validateandupdate.
I checked the code and you are deleting it on:
https://github.com/masylum/mongolia/blob/master/lib/model.js
line 248: delete options.namespace;
And trying to use right after on:
line 252: MODEL.collection_proxy.namespacer.filter(MODEL.namespaces, options.namespace, 'update', args);
Can you check please?
Many thanks and congrats for the excellent work.
Regards,
Thiago
onCreate, onUpdate, afterCreate and afterUpdate should accept callbacks.
This way I could remove the unnecessary afterCreateInstance
Update, insert, findAndModify, updateEmbeddedDocument, pushEmbeddedDocument ... Make callbacks optional
By doing this I could implement alias
, namespaces
and mappings
for find
operations too.
Just proxy the find method to return a proxied cursor, and so on... INCEPTION!
We could have a findPaginated
custom collection function that returns {results, paginator}
If I want people to get involved I need some community attention!
Mongolia should work out of the box.
All the missing things from ext.js or class.js should go to utils.js
I think it would be nice to allow deeper attributes, so we could have:
User.maps = {
email: String
, posts: {
count: Number
, titles: function (val) {
return val.join(', ');
}
}
};
User.namespaces = {
post_form: ['email', 'post.titles']
, post_admin: ['post']
}
I think validateAndInsert and validateAndUpdate are more appropriated.
Just curious as to the plans for the future of this project?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.