<commit_before>**THIS IS CURRENTLY A REQUEST-FOR-COMMENTS WHITE-PAPER**

**THIS PROJECT IS NON-FUNCTIONAL - PLEASE DO NOT INSTALL IT**


Mongol
======
A nicer way to work with Mongo.

Mongol attempts to provide nicer, chainable functionality on top of base Mongo while making some of the more C centric designs of Mongo more Node like.


Features
========
Mongol builds on the [DWIM](https://en.wikipedia.org/wiki/DWIM) philosophy where certain functionality is handled by Mongol to get the expected results.


Proper chainability
-------------------
While libraries like Mongoose provide some chainable methods they don't quite work as expected. For example

	users
		.find()
		.populate('widgets')
		.where('widgets.enabled', true)
		.exec(handler);

Will *not* work in Mongo or Mongoose due to the way that populate is a late binding. Mongol however will see that widgets needs popuating THEN the where needs to be executed later on and actually make all this work.


JavaScript style casing
-----------------------<commit_msg>Added section on deep population<commit_after>**THIS IS CURRENTLY A REQUEST-FOR-COMMENTS WHITE-PAPER**

**THIS PROJECT IS CURRENTLY NON-FUNCTIONAL - PLEASE DO NOT INSTALL IT**


Mongol
======
A nicer way to work with Mongo.

Mongol attempts to provide nicer, chainable functionality on top of base Mongo while making some of the more C centric designs of Mongo more Node like.


Features
========
Mongol builds on the [DWIM](https://en.wikipedia.org/wiki/DWIM) philosophy where certain functionality is handled by Mongol to get the expected results.


Proper chainability
-------------------
While libraries like Mongoose provide some chainable methods they don't quite work as expected. For example

	users
		.find()
		.populate('widgets')
		.where('widgets.enabled', true)
		.exec(handler);

Will *not* work in Mongo or Mongoose due to the way that populate is a late binding. Mongol however will see that widgets needs popuating THEN the where needs to be executed later on and actually make all this work.


Deep population
---------------
With Mongo / Mongoose at present you are limited to the first-layer-only of population.

For example assuming you had three collections: `foo`, `bar` and `baz` each having a foreign key linking them all together. The temptation is to do something like this during a retrieval:

	foo
		.find()
		.populate('bar')
		.populate('bar.baz');
		.exec(handler)

However that will not work. Only the first level of population (in this case `foo.bar`) will be executed. The second level (`foo.bar.baz`) will not be actioned. Worse than that - it will also fail silently.

Mongol supports multi-level population automatically. The final handler (`exec()`) will only be invoked when all requested populations are executed first.


JavaScript style casing
-----------------------
{'fraction_non_alphanumeric': 0.10422535211267606, 'fraction_numerical': 0.0, 'mean_word_length': 3.634584013050571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1607922', 'n_tokens_mistral': 803, 'n_tokens_neox': 722, 'n_words': 380}