Firebase EqualTo只返回一条记录 - 应返回多条记录

时间:2017-09-21 02:17:00

标签: javascript firebase firebase-realtime-database

参考位于https://firebase.google.com/docs/reference/js/firebase.database.Query

的Firebase文档和示例

他们的医生说它应该归还所有高度为25的恐龙。它只返回一只。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
	.hm-property {
		margin-top: 10px;
	}

	.hm-fieldset {
		margin-top: 12px;
		width: 505px;
		height: 175px;
		border: 1px groove #ddd !important;
		padding: 0 10px 10px 10px !important;
	}

	.hm-legend {
		font-size: 15px;
		font-weight: normal;
		font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
		font-size: 14px;
		color: #555;
		border-bottom: none;
		padding: 0 10px;
		width: auto;
	}
</style>

<div class="hm-editorslist">
	<label class="hm-fieldItemLabel">Heatmap Engine Editors:</label>
	<select class="hm-fieldItemBig" id="hmeditorcbo"></select>
	<div class="hm-EditorAdd glyphicon glyphicon-plus" id="btnNewHMEditor" title="Add New Heatmap Engine Editor"></div>
	<div class="hm-EditorRemove glyphicon glyphicon-remove" id="btnDeleteHMEditor" title="Remove Selected Heatmap Engine Editor"></div>
	<span class="alert-info pageAlertBox LoadHMTemplate-info" style="display:none;"><strong>Loading.....</strong></span>
	<div>
		<fieldset class="hm-fieldset">
			<legend class="hm-legend">Engine Settings:</legend>
			<!--Engine Destination Folder textbox-->
			<div class="hm-property">
				<label class="hm-fieldItemLabel">Destination Folder:</label><input type="text" class="hm-textboxes" id="hmEngineDestFolder"
					title="The relative destination path of engine" />
			</div>

			<!--Engine Integrity Refresh Rate textbox-->
			<div class="hm-property">
				<label class="hm-fieldItemLabel">Integrity Refresh Rate:</label><input type="text" class="hm-textboxes"
					id="hmEngineIntegrityRate" title="Engine's integrity refresh rate (in minutes)" />
			</div>

			<!--Engine Source Folder textbox-->
			<div class="hm-property">
				<label class="hm-fieldItemLabel">Source Folder Path:</label><input type="text" class="hm-textboxes" id="hmSourceFolder"
					title="The relative source path of engine" />
			</div>
		</fieldset>
	</div>

	<!--GUI File Location textbox-->
	<div class="hm-property">
		<label class="hm-fieldItemLabel">GUI File Location Path:</label><input type="text" class="hm-textboxes" id="hmGUIFileLoc"
			title="Relative folder path to the file" />
	</div>
</div>

我的数据如下:

// Find all dinosaurs whose height is exactly 25 meters.
var ref = firebase.database().ref("dinosaurs");
ref.orderByChild("height").equalTo(25).on("child_added", function(snapshot) 
{
  console.log(snapshot.key);
});

有人可以澄清为什么我只能获得一条记录,如果文档说它应该全部返回?

0 个答案:

没有答案