function dbQueryToDottedField(query) {
  const path = [...query.path];
  let currentQuery = query;

  while (currentQuery.type === `elemMatch`) {
    currentQuery = currentQuery.nestedQuery;
    path.push(...currentQuery.path);
  }

  return path.join(`.`);
}
/**
 * Takes a DbQuery structure and returns a dotted representation of a field referenced in this query.
 *
 * Example:
 * ```js
 *   const query = createDbQueriesFromObject({
 *     foo: { $elemMatch: { id: { $eq: 5 }, test: { $gt: 42 } } },
 *     bar: { $in: [`bar`] }
 *   })
 *   const result = query.map(dbQueryToDottedField)
 * ```
 * Returns:
 *   [`foo.id`, `foo.test`, `bar`]
 */
Takes a DbQuery structure and returns a dotted representation of a field referenced in this query.
Takes a DbQuery structure and returns a dotted representation of a field referenced in this query .
function dbQueryToDottedField(query) {
  const path = [...query.path];
  let currentQuery = query;
  while (currentQuery.type === `elemMatch`) {
    currentQuery = currentQuery.nestedQuery;
    path.push(...currentQuery.path);
  }
  return path.join(`.`);
}
function dbQueryToDottedField ( query ) { const path = [ ... query . path ] ; let currentQuery = query ; while ( currentQuery . type === ` ` ) { currentQuery = currentQuery . nestedQuery ; path . push ( ... currentQuery . path ) ; } return path . join ( ` ` ) ; }
Takes a DbQuery structure and returns a dotted representation of a field referenced in this query.
Takes a DbQuery structure and returns a dotted representation of a field referenced in this query .