Dan Dascalescu
Dan Dascalescu

Reputation: 152018

What exactly is the difference between an "attribute" and a "field" in MongoDB terminology?

I've seen the terms "attribute" and "field" used interchangeably, and I'd like to know what the proper usage is. So far, it seems that "fields" are what's stored in the database objects, and "attributes" are key-value pairs used in client code, such as in find() calls.

Upvotes: 3

Views: 2188

Answers (1)

JohnnyHK
JohnnyHK

Reputation: 311865

MongoDB documents contain key-value pairs, where each pair can be interchangeably referred to as a "field", "property", or (less frequently, but not inaccurately) "attribute".

Using "field" or "property" is probably best.

Upvotes: 3

Related Questions