Suppose you have the given schema in Mongoose; how does it impact the collection?
import { Schema } from "mongoose";
export interface IString {
property: string;
}
export const PriceOverhaulSchema = new Schema<IString>({
property: { type: String, required: false, unique: true },
});
I am curious about the unique constraint's behavior within this schema. If a single document is missing the property field, can another document exist without violating the uniqueness constraint? In other words, does the uniqueness constraint solely apply to documents with the property set, or is it enforced regardless of whether the property is set?
Your insights or clarifications on this issue are greatly appreciated.