feat: Complete CouchDB migration and Docker configuration
- Add comprehensive CouchDB setup and configuration - Update Docker files for CouchDB compatibility - Create Kubernetes manifests for CouchDB deployment - Add migration scripts and documentation - Update seeding scripts to support both CouchDB and MongoDB - Add docker-compose for local development - Create comprehensive setup and deployment guides 🤖 Generated with [AI Assistant] Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
103
node_modules/mongoose/lib/helpers/populate/getVirtual.js
generated
vendored
Normal file
103
node_modules/mongoose/lib/helpers/populate/getVirtual.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = getVirtual;
|
||||
|
||||
/*!
|
||||
* ignore
|
||||
*/
|
||||
|
||||
function getVirtual(schema, name) {
|
||||
if (schema.virtuals[name]) {
|
||||
return { virtual: schema.virtuals[name], path: void 0 };
|
||||
}
|
||||
|
||||
const parts = name.split('.');
|
||||
let cur = '';
|
||||
let nestedSchemaPath = '';
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
cur += (cur.length > 0 ? '.' : '') + parts[i];
|
||||
if (schema.virtuals[cur]) {
|
||||
if (i === parts.length - 1) {
|
||||
return { virtual: schema.virtuals[cur], path: nestedSchemaPath };
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (schema.nested[cur]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (schema.paths[cur] && schema.paths[cur].schema) {
|
||||
schema = schema.paths[cur].schema;
|
||||
const rest = parts.slice(i + 1).join('.');
|
||||
|
||||
if (schema.virtuals[rest]) {
|
||||
if (i === parts.length - 2) {
|
||||
return {
|
||||
virtual: schema.virtuals[rest],
|
||||
nestedSchemaPath: [nestedSchemaPath, cur].filter(v => !!v).join('.')
|
||||
};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i + 1 < parts.length && schema.discriminators) {
|
||||
for (const key of Object.keys(schema.discriminators)) {
|
||||
const res = getVirtual(schema.discriminators[key], rest);
|
||||
if (res != null) {
|
||||
const _path = [nestedSchemaPath, cur, res.nestedSchemaPath].
|
||||
filter(v => !!v).join('.');
|
||||
return {
|
||||
virtual: res.virtual,
|
||||
nestedSchemaPath: _path
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nestedSchemaPath += (nestedSchemaPath.length > 0 ? '.' : '') + cur;
|
||||
cur = '';
|
||||
continue;
|
||||
} else if (schema.paths[cur]?.$isSchemaMap && schema.paths[cur].$__schemaType?.schema) {
|
||||
schema = schema.paths[cur].$__schemaType.schema;
|
||||
++i;
|
||||
const rest = parts.slice(i + 1).join('.');
|
||||
|
||||
if (schema.virtuals[rest]) {
|
||||
if (i === parts.length - 2) {
|
||||
return {
|
||||
virtual: schema.virtuals[rest],
|
||||
nestedSchemaPath: [nestedSchemaPath, cur, '$*'].filter(v => !!v).join('.')
|
||||
};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i + 1 < parts.length && schema.discriminators) {
|
||||
for (const key of Object.keys(schema.discriminators)) {
|
||||
const res = getVirtual(schema.discriminators[key], rest);
|
||||
if (res != null) {
|
||||
const _path = [nestedSchemaPath, cur, res.nestedSchemaPath, '$*'].
|
||||
filter(v => !!v).join('.');
|
||||
return {
|
||||
virtual: res.virtual,
|
||||
nestedSchemaPath: _path
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nestedSchemaPath += (nestedSchemaPath.length > 0 ? '.' : '') + '$*' + cur;
|
||||
cur = '';
|
||||
}
|
||||
|
||||
if (schema.discriminators) {
|
||||
for (const discriminatorKey of Object.keys(schema.discriminators)) {
|
||||
const virtualFromDiscriminator = getVirtual(schema.discriminators[discriminatorKey], name);
|
||||
if (virtualFromDiscriminator) return virtualFromDiscriminator;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user