New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ts-mongoose

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-mongoose - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

.github/custom.png

2

package.json
{
"name": "ts-mongoose",
"version": "0.0.16",
"version": "0.0.17",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,3 +34,3 @@ # ts-mongoose

zip: String,
});
}, { _id: false, timestamps: true });

@@ -62,2 +62,7 @@ const PhoneSchema = new Schema({

},
gender: {
type: Schema.Types.String,
required: true,
enum: ['male', 'female']
},
otherId: {

@@ -75,3 +80,3 @@ type: Schema.Types.ObjectId,

},
});
}, { timestamps: { createdAt: true } });

@@ -94,2 +99,4 @@ interface UserProps extends Document {

const genders = ['male', 'female'] as const;
const AddressSchema = createSchema({

@@ -99,3 +106,3 @@ city: Type.string(),

zip: Type.optionalString(),
}, { _id: false });
}, { _id: false, timestamps: true });

@@ -122,6 +129,7 @@ const PhoneSchema = createSchema({

m: Type.mixed(),
gender: Type.string({ enum: genders }),
otherId: Type.objectId(),
address: Type.schema().of(AddressSchema),
phones: Type.array().of(PhoneSchema),
});
}, { timestamps: { createdAt: true } });

@@ -154,2 +162,10 @@ const User = typedModel('User', UserSchema);

```
- Note that enum values need to be readonly array to be treated as literals by typescript
```ts
const genders = ['male', 'female'] as const;
{
// same as {type: String, required: true, enum: ['male', 'female']}
gender: Type.string({enum: genders})
}
```
- `schema`, `object`, `array` types have a method `of` where you must provide a child type

@@ -164,3 +180,3 @@ ```ts

```ts
const AddressSchema = createSchema({city: Type.string()}, { _id: false });
const AddressSchema = createSchema({city: Type.string()}, { _id: false, timestamps: true });
{

@@ -167,0 +183,0 @@ // same as {type: AddressSchema}

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc