def setUp(self): metadata = Metadata() subdoc = subdocument(metadata, 'subdoc', Field('x', int)) self.MyDoc = collection( metadata, 'mydoc', Field('y', subdoc, default=None))
def setUp(self): metadata = Metadata() subdoc = subdocument(metadata, "subdoc", Field("x", int)) self.MyDoc = collection( metadata, "mydoc", Field("x", subdoc), Field("y", [subdoc]) ) self.doc = self.MyDoc.m.create(x=dict(x=5), y=[])
def test_can_make_schema(self): metadata = Metadata() subdoc = subdocument(metadata, 'subdoc', Field('x', int)) self.MyDoc = collection( metadata, 'mydoc', Field('x', subdoc), Field('y', [subdoc]))
def setUp(self): metadata = Metadata() subdoc = subdocument(metadata, 'subdoc', Field('x', int)) self.MyDoc = collection( metadata, 'mydoc', Field('x', subdoc), Field('y', [subdoc])) self.doc = self.MyDoc.m.create(x=dict(x=5), y=[])
def setUp(self): self.metadata = metadata.Metadata() self.Doc = subdocument( self.metadata, 'Doc', field.Field('x', int))
import bson from pymongo import ReturnDocument import barin as b import barin.schema as s log = logging.getLogger(__name__) metadata = b.Metadata() # Message statuses: pending, ready, busy, error _schedule = b.subdocument( metadata, '_schedule', b.Field('priority', int, default=10), b.Field('after', datetime, default=datetime.fromtimestamp(0)), b.Field('status', str, default='pending'), b.Field('message', str, default=''), b.Field('worker', str, default=None)) @b.cmap(b.collection( metadata, 'c2.message', b.Field('_id', s.ObjectId, default=bson.ObjectId), b.Field('s', metadata.cref('_schedule')), b.Field('task', str), b.Field('payload', {str: None}))) class Message(object): def __repr__(self): return '<Message {}: {}>'.format(self._id, self.task)
def test_can_make_schema(self): metadata = Metadata() subdoc = subdocument(metadata, "subdoc", Field("x", int)) self.MyDoc = collection( metadata, "mydoc", Field("x", subdoc), Field("y", [subdoc]) )
def setUp(self): metadata = Metadata() subdoc = subdocument(metadata, "subdoc", Field("x", int)) self.MyDoc = collection( metadata, "mydoc", Field("y", subdoc, default=None) )
def setUp(self): self.metadata = metadata.Metadata() self.Doc = subdocument(self.metadata, 'Doc', field.Field('x', int))