Comments (3)
This is more of a bug report than a feature request. Either way, I'm unable to repro, the following example shows that find({ name: undefined })
is equivalent to find({ name: null })
, which doesn't return all documents. This is in Mongoose 8.1.1. Please modify the following script to demonstrate the issue you're seeing.
'use strict';
const mongoose = require('mongoose');
mongoose.set('debug', true);
run().catch(err => console.log(err));
async function run() {
await mongoose.connect('mongodb://127.0.0.1:27017/mongoose_test');
const Test = mongoose.model('Test', mongoose.Schema({ name: String }));
await Test.deleteMany({});
await Test.create({ name: 'foo' }, { name: null });
// Prints 1 doc with `name: null`
console.log(await Test.find({ name: undefined }));
// Prints 2 docs
console.log(await Test.find({}));
}
from mongoose.
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days
from mongoose.
This issue was closed because it has been inactive for 19 days and has been marked as stale.
from mongoose.
Related Issues (20)
- log : import_mongoose.default.connect is not a function HOT 1
- Type is incorrect for Query.distinct when field is a nested field HOT 1
- Not Work `new mongoose.Types.ObjectId` HOT 1
- Default values sometimes do not work when creating a document HOT 1
- Populate does not consider toJSON and id:true HOT 2
- Bulk operations not including shardKey
- MongooseError: Operation `prefixes.findOne()` buffering timed out after 10000ms and MongooseServerSelectionError: connect ECONNREFUSED 13.200.189.28:27017 HOT 1
- MongoServerError: cannot create a new collection -- already using 527 collections of 500 HOT 1
- Is there a way to preserve documents modifications when a doc is modified and then populated? HOT 2
- Typescript sees the Boolean Constructor Type as Date when using Mongoose HOT 6
- getting _id as unknown type HOT 5
- "operation-start" event of the MongooseConnection
- Mismatch between the type derived from the ```lean``` query and the declared interface on virtual fields HOT 3
- Documentation site down? HOT 1
- Type 'import(".../node_modules/mongoose/node_modules/mongodb/mongodb").MongoClient' is not assignable to type 'import(".../node_modules/mongodb/mongodb").MongoClient'. HOT 5
- BSON Timestamp in a mongoose schema
- The return type of connection.tranaction method should not be Promise<void>.
- [Feature] Add option to disable filters on each method HOT 2
- InferRawDocType returns `unknown` for every property instead of the right type HOT 1
- TS: _id not required on DocumentArray properties of documents returned from query HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose.