tomitrescak / apollo-connector-mongodb

Apollo Connector for MongoDB with caching
24 stars 3 forks source link

Mongoose schema. #1

Open smooJitter opened 7 years ago

smooJitter commented 7 years ago

How does this play with mongoose.

For example, consider we have a schema like this

const UserSchema = new mongoose.Schema({ username: { type: String, required: true }, mobileNumber: { type: String }, createdAt: { type: Date, default: Date.now } });

Where the mongodb collection is tied to the mongoose model like usually

User = mongoose.model('User', UserSchema);

I gather the graphQL schema is sufficient? And thus any input and default behaviors should be handled via the Entity definition?

tomitrescak commented 7 years ago

@smooJitter unfortunately this is made to work with native mongo driver. The whole apckage is optimised to run with it. I use Typescript and GraphQL (Apollo) so I have no need for mongoose ;(