In NoSQL you will have to model the data for the way your app wants to use it. So if you need a list of the conversations that the user is part of, you should keep that list in your database:
/conversationMessages
$conversationId
$messageId
text: "Hello world"
sender: "uid of sender"
name: "name of sender"
/userConversations
$uid
$conversationId1: true
$conversationId2: true
With this you can easily look up the list of conversations that each user is a part of and then load the messages for one of them. You'll probably also want to keep a separate list of the metadata for each conversation:
/conversationMetadata
$conversationId
lastUpdated: timestamp (set with ServerValue.TIMESTAMP)
title: "name of our chat room"
That way you can show the list of conversations for a user by loading their conversation ids and then loading the metadata of each conversation:
var ref = database.ref().child("userConversations").child(auth.uid);
ref.on('child_added', function(conversationKey) {
var conversationRef = database.ref().child("conversationMetadata").child(conversationKey.key);
conversationRef.once('value', function(metadataSnapshot) {
console.log(metadataSnapshot.val());
});
});
Trying to map SQL knowledge onto a NoSQL database leads to a difficult learning experience. I highly recommend reading the relevant section of the Firebase documentation and this article about NoSQL data modeling.