Closed bwgjoseph closed 3 years ago
Hi @bwgjoseph as far as I remember there is a strict option in Ottoman as well. Let me check
@bwgjoseph so Ottoman has this schema option {validationStrategy: VALIDATION_STRATEGY.STRICT} but the purpose is slightly different.
It does not check for extra fields but validates what Schema has, for instance if you have a number but have specified a string, strict will fail even though string can be converted to a number.
I will open a ticket to address the one we were talking about
Ticket https://github.com/couchbaselabs/node-ottoman/issues/323 should address this
Hi,
Seem like there's some issue when using strict: false
const schema = new ottoman.Schema({
name: String,
}, { strict: false });
const model = ottoman.model('nonstrictschema', schema);
const created = await model.create({ name: 'hello', notInSchema: true });
console.log('created', created);
const find = await model.find({}, { consistency: ottoman.SearchConsistency.LOCAL });
console.log('find', find);
This is returned from create model.create
which has the notInSchema
field
_Model {
name: 'hello',
notInSchema: true,
id: 'bdb0a15a-9f20-43f7-b8cb-813309c6514e',
_type: 'nonstrictschema'
}
But using find
, it does not return notInSchema
field
{
meta: {
requestId: '9326bddf-8315-45d8-8476-ef024528d7a0',
clientContextId: 'a8bd4c4d4a799268',
status: 'success',
signature: { '*': '*' },
profile: undefined,
metrics: {
elapsedTime: 15.5699,
executionTime: 15.4941,
sortCount: undefined,
resultCount: 1,
resultSize: 86,
mutationCount: undefined,
errorCount: undefined,
warningCount: undefined
}
},
rows: [
_Model {
_type: 'nonstrictschema',
id: 'bdb0a15a-9f20-43f7-b8cb-813309c6514e',
name: 'hello'
}
]
}
Thanks @bwgjoseph have notified to the team they will look into it
@bwgjoseph this is a bug and will be fixed with next release
hello @bwgjoseph alpha.13 was released yesterday, can you please verify.
Please see #39, seem like there's some issue
issue #39 seems to be a configuration issue
Hi,
data get gets passed in but does not adhere to the schema should be auto dropped? In
mongoose
, there's a strict option that we are using to define, if I want it to be less strict.Meaning save anything that is being passed on, as what a schema-less database should be, but because this is a "schema" driver, then data saved should adhered to the schema that is being provided until otherwise.
This is the output
Thanks