Something peculiar is occurring with my Typescript code. Here's the snippet I'm running:
for await (const expression of Expression.find({'definiton': { $exists: true }}))
{
console.log(Utils.stringize(expression))
}
Despite this, the output shows a document without the definition
field:
{
"_id": "63cc466d2c2338ef26205618",
"labels": [
"⊥"
],
"author": {
"userId": "63cc466c2c2338ef26205609",
"username": "webmaster"
},
"timestampCreation": "2023-01-21T20:09:17.027Z",
"tags": [
"native symbol",
"logic",
"mathematics",
"false"
],
"nbrViews": 1,
"nbrUsesInExpressions": 2,
"nbrUsesInTruths": 0,
"idsUsedExpressions": [],
"idsUsedExtraAxioms": [],
"type": {
"sort": "P"
},
"parameters": [],
"__v": 0
}
If you need more information, here is the Mongoose schema for the collection:
const expressionSchema = new Schema<IExpression>({
labels: {
required: true,
type: [String],
//unique: false,
trim: true
},
author: {
type: Schema.Types.Mixed, //Author,
required: true,
},
//timestampCreation: Date,
timestampCreation: {
type: Date,
required: true,
},
tags: {
required: true,
type: [String],
trim: true
},
nbrViews: {
required: true,
type: Number,
},
nbrUsesInExpressions: {
required: true,
type: Number,
},
nbrUsesInTruths: {
required: true,
type: Number,
},
idsUsedExpressions: {
type: [Schema.Types.ObjectId],
},
idsUsedExtraAxioms: {
required: true,
type: [Schema.Types.ObjectId],
},
type: {
required: true,
type: Schema.Types.Mixed //Sort|UnknownType|CompoundType
},
parameters: {
type: Array
},
definition: {
type: Schema.Types.Mixed //StatementBoundVariables,
},
idInstantiatedTruth: {
type: Schema.Types.ObjectId,
},
idResultingTruth: {
type: Schema.Types.ObjectId,
}
})
I've attempted various approaches like 'definiton': { $ne: null }
and
Expression.find().where('definiton').exists(true))
, but the issue persists. Any ideas on how to solve this?
Curious if anyone else has encountered this before.