{
orderId: sample2,
restaurantId: cartssj,
dateTime: fdsfd,
status: pending,
cartItems: [
{
"itemId": "1001",
"itemName": "Onion",
"requestedQty": "1",
"fulfilledQty": "1",
"pricePerUnit": "78"
},
{
"itemId": "1002",
"itemName": "Potato",
"requestedQty": "1",
"fulfilledQty": "1",
"pricePerUnit": "35"
},
{
"itemId": "1003",
"itemName": "Carrot",
"requestedQty": "1",
"fulfilledQty": "1",
"pricePerUnit": "78"
},
{
"itemId": "1004",
"itemName": "Toamto",
"requestedQty": "1",
"fulfilledQty": "1",
"pricePerUnit": "90"
}
],
total: 281.0
}
from django.db import models
from mongoengine import Document,fields,EmbeddedDocument,EmbeddedDocumentListField
class CartItem(EmbeddedDocument):
itemId = fields.StringField(max_length=254,uniique=True)
itemName = fields.StringField(max_length=254)
requestedQty = fields.StringField(max_length=100)
fulfilledQty = fields.StringField(max_length=100)
pricePerUnit = fields.StringField(max_length=100)
class Order(Document):
orderId = fields.StringField(max_length=254)
restaurantId = fields.StringField(max_length=100)
dateTime = fields.StringField(max_length=254)
status = fields.StringField(max_length=254)
cartItems = fields.EmbeddedDocumentListField(CartItem)
total = fields.StringField(max_length=254)
meta = {'collection': 'orders'}
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a6529746-9471-4f98-9d4c-bf6b508bb0b3%40googlegroups.com.