簡體   English   中英

無法從MongoDB,Doctrine ODM中檢索字符串和嵌入式數據

[英]Can't retrieve string and embedded data from MongoDB, Doctrine ODM

我的文檔

/**
 * Class CellCoordinates
 *
 * @package Community\UserBundle\Document
 *
 * @MongoDB\EmbeddedDocument
 */
class CellCoordinates
{

/**
 * @MongoDB\Float
 */
protected $latitude;

/**
 * @MongoDB\Float
 */
protected $longitude;

/**
 * Class CellStatus
 *
 * @package Community\UserBundle\Document
 * @MongoDB\Document(collection="cell_status")
 * @MongoDB\Index(keys={"cell_coordinates"="2d"})
 */
class CellStatus
{

/**
 * @MongoDB\Id
 */
protected $id;

/**
 * @MongoDB\Int
 */
protected $cellId;

/**
 * @MongoDB\String
 */
protected $type;

/**
 * @MongoDB\Timestamp
 */
protected $timestamp;

/** @MongoDB\EmbedOne(targetDocument="Community\UserBundle\Document\CellCoordinates") */
protected $location;

我試圖以這種方式從文檔中檢索數據: $cellStatus->getType()$cellStatus->getLocation()->getLatitude() ,但是什么也沒得到。 所有這些方法都將返回null。

但是,當我通過shell查詢mongoDB時,我可以在該字段中看到數據。

我做錯了什么?

更新后神秘地解決了此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM