I'm making a web app which allows users to create their own custom MongoDB collections on my server by first 'registering' the schema in a client-side form.
So the user will create a schema client side - say using a form like this: http://r.github.com/annotationsformatter/
So the client-side Js will generate a JSON object of the form, for example:
{
"collection_name": "person",
"data":
{
"name": "String",
"email": "String",
"id", "Number",
}
}
Next, the page will send this object to the server, which should convert the stuff in data
to a proper Mongoose Schema and create a collection from it, of collection name person
.
I'm lost - how would I go about doing this? I'm talking about the conversion-to-schema part.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…