<commit_before>'use strict';

/**
 * AMNA: Amazing Mongoose Node.js API
 *
 * @author <NAME>
 * @url https://github.com/NateFerrero/amna
 *
 * AMNA - Collection
 */
var q = require('q');

module.exports = function (amna) {

    amna.mongoId = function (param) {
        return ':' + param + '([0-9a-f]{24})';
    };

    /**
     * Handle pagination and deleted records
     */
    amna.pageAndDeleteQuery = function (self) {
        var query = {};
        var qOpts = self.req.jsonQueryOptions;

        /**
         * Populate for collectionGet
         */
        if ('populate' in qOpts) {
            self.req.populate = [qOpts.populate];
            delete qOpts.populate;
        }

        /**<commit_msg>[collection] Update to populate syntax<commit_after>'use strict';

/**
 * AMNA: Amazing Mongoose Node.js API
 *
 * @author <NAME>
 * @url https://github.com/NateFerrero/amna
 *
 * AMNA - Collection
 */
var q = require('q');

module.exports = function (amna) {

    amna.mongoId = function (param) {
        return ':' + param + '([0-9a-f]{24})';
    };

    /**
     * Handle pagination and deleted records
     */
    amna.pageAndDeleteQuery = function (self) {
        var query = {};
        var qOpts = self.req.jsonQueryOptions;

        /**
         * Populate for collectionGet
         */
        if ('populate' in qOpts) {
            self.req.populate = qOpts.populate.map(function (pop) {
                return Array.isArray(pop) ? pop : [pop];
            });
            delete qOpts.populate;
        }

        /**
{'fraction_non_alphanumeric': 0.1483160621761658, 'fraction_numerical': 0.0051813471502590676, 'mean_word_length': 1.9150943396226414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '772439', 'n_tokens_mistral': 499, 'n_tokens_neox': 492, 'n_words': 107}