Deprecated "Class" inserted instead of "Ref" after create a new document

Hi everyone, I found a strange behavior when creating collections. Maybe someone could help me to clarify this behavior:

I have 3 collections with the following names:

  • classes
  • instructors
  • schedules

The documents on the “schedules” collection contains references to “classes” and “instructors”, so I am using the following query to create a schedule document:

Create(Collection("schedules"), {
  data: {
    instructor: Ref(Collection("instructors"), "272520429002818066"),
    class: Ref(Collection("classes"), "268697866226106880"),

The query executes well, however the data inserted looks like this:

  "ref": Ref(Collection("schedules"), "274572704420463122"),
  "ts": 1598111786260000,
  "data": {
    "instructor": Ref(Collection("instructors"), "272520429002818066"),
    "class": Class("268697866226106880"),

The “class” property DOESN’T contain a reference to the classes collection, it contains a “Class()” function, that is deprecated according to the docs, why am I not getting a reference in this case? Is there a restriction regarding the name of the collection named “classes”.

Appreciate any help

I’ve created an index in order to get documents on “schedules” by the term “class”

    name: 'schedule_by_class',
	source: Collection('schedules'),
	terms: [{
		field: ['data', 'class']

This works well when querying the data, so there’s not an important issue.

			Ref(Collection('classes'), '272251056121971218')
	Lambda(item => Get(item))

however the presence of the deprecated “Class” function seems suspicious to me…

This sounds like a possible naming collision. Earlier Collections were called Classes and I know fauna has several internal “collections” as well. I just verified this and it seems like the data coming back on the wire is fine, so my guess is that this is an issue with the JS driver. If you use TitleCase “Classes” there is no issue… (I personally do this).

Yes, you were right, I’ve renamed my collection and I am seeing the right reference now… Thanks for your help!