This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
Package Marango provides an intuitive ODM (Object Document Model) library for working with MongoDB documents. It builds on top of the awesome mgo library
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
This package is an object document mapper for mongodb which uses the mgo adapter. First step is to create a model, for example: It is important that each schema embeds the IDocumentBase type (mongodm.DocumentBase) and make sure that it is tagged as 'inline' for json and bson. This base type also includes the default values id, createdAt, updatedAt and deleted. Those values are set automatically from the ODM. The given example also uses a relation (User has Messages). Relations must always be from type interface{} for storing bson.ObjectId OR a completely populated object. And of course we also need the related model for each stored message: Note that when you are using relations, each model will be stored in his own collection. So the values are not embedded and instead stored as object ID or array of object ID's. To configure a relation the ODM understands three more tags: But it is not necessary to always create relations - you also can use embedded types: Persisting a customer instance to the database would result in embedding an complete address object. You can embed all supported types. Now that you got some models it is important to create a connection to the database and to register these models for the ODM.
Package mgod implements ODM logic for MongoDB in Go.