如何仅在Firebase数据库中获取更改的值?因为每次我更改dir
上的值,例如
/ some_user
~ id
~ name
/ data
~ order_id
~ order_name <<= Changed in here
但是当我获得更改的数据时,我获得了所有树结构,而不仅仅是更改了数据order_name
。所以我只想让它返回这样的东西:
/ some_user
/ data
~ order_name <<= Specific changed data
因此,我可以确定已更改的确切key
数据是什么。我怎样才能做到这一点?感谢。
答案 0 :(得分:5)
将侦听器附加到order_name引用。
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = MySpringConfiguration.class)
@WebAppConfiguration
public class ApiDocumentation {
private MockMvc mockMvc;
@Rule
public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("target/generated-snippets");
@Autowired
private WebApplicationContext context;
@Autowired
private ObjectMapper objectMapper;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation))
.build();
}
@Test
public void testSomething() throws Exception {
}
}