MCPcopy Create free account
hub / github.com/Automattic/mongoose / withCustomVersionKeyAndSchemaToObject

Function withCustomVersionKeyAndSchemaToObject

test/types/document.test.ts:807–821  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

805 }
806
807 function withCustomVersionKeyAndSchemaToObject() {
808 const ASchema = new Schema({
809 testProperty: Number
810 }, {
811 versionKey: 'taco' as const,
812 toObject: { versionKey: false }
813 });
814
815 const AModel = model('YourModel', ASchema);
816
817 const a = new AModel({ testProperty: 8 });
818
819 expect(a.toObject()).type.not.toHaveProperty('taco');
820 expect(a.toJSON().taco).type.toBe<number>();
821 }
822}
823
824function testFlattenUUIDs() {

Callers

nothing calls this directly

Calls 3

modelFunction · 0.85
toObjectMethod · 0.80
toJSONMethod · 0.45

Tested by

no test coverage detected