Category : mongodb

I have symfony 3.4 and used Doctrine MongoDB Bundle "doctrine/mongodb-odm": "1.1", "doctrine/mongodb-odm-bundle": "3.4", I have locally installed mongo and used with below configuration working fine. mongodb_server: ‘mongodb://mongo:27017’ mongodb_collection: test doctrine_mongodb: connections: default: server: "%mongodb_server%" options: {} default_database: "%mongodb_collection%" but now i try to access mongodb atlas cluster at this time i have getting below error. ..

Read more

Setup I’m using mongoDB in API Platform and I created the following Attribute document: /** * @ApiResource * @ODMDocument */ class Attribute { /** * @ODMEmbedOne( * discriminatorField="type", * discriminatorMap={ * "string"=ValueString::class, * "number"=ValueNumber::class * }, * defaultDiscriminatorValue="string" * ) */ public $value; } The attribute document can embed one of the following EmbeddedDocuments: /** ..

Read more

I try to save data via api platform (4.4.16) and receive an error like this: "hydra:description": "Failed to denormalize attribute "bandwidth30Days" value for class "AppDocumentTestData": Expected argument of type "DoctrineCommonCollectionsCollection", "array" given at property path "bandwidth30Days".", Pattern: { "id": "string", "device": { "id": 0, "groupId": 0, "groupName": "string", "name": "string" }, "bandwidth30Days": [ { "fromDate": ..

Read more

**I’m getting the following error: ** Service "event_dispatcher" not found: even though it exists in the app’s container, the container inside "AppControllerRatingApiController" is a smaller service locator that only knows about the "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services. Try using dependency injection instead. I’m used to using $this->get(‘event_dispatcher’)->dispatch( ..

Read more

I’m trying to order my embed documents. The field looks like this /** * @ODMEmbedMany(targetDocument=Image::class, strategy="set") * @ODMIndex(keys={"order"="asc"}) * @Groups({"offer:read"}) */ protected $images = []; The Image EmbeddedDocument namespace AppDocumentEmbedded; use AppDocumentTraitsNameableTrait; use AppDocumentTraitsOrderableTrait; use DoctrineODMMongoDBMappingAnnotations as ODM; /** * @ODMEmbeddedDocument */ class Image { use NameableTrait; use OrderableTrait; … } And the orderable trait ..

Read more

I’m trying to order my embed documents. The field looks like this /** * @ODMEmbedMany(targetDocument=Image::class, strategy="set") * @ODMIndex(keys={"order"="asc"}) * @Groups({"offer:read"}) */ protected $images = []; The Image EmbeddedDocument namespace AppDocumentEmbedded; use AppDocumentTraitsNameableTrait; use AppDocumentTraitsOrderableTrait; use DoctrineODMMongoDBMappingAnnotations as ODM; /** * @ODMEmbeddedDocument */ class Image { use NameableTrait; use OrderableTrait; … } And the orderable trait ..

Read more