diff --git a/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs b/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs index e2304740e3a..622583c2a5f 100644 --- a/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs +++ b/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs @@ -319,9 +319,10 @@ async fn find_ids( builder.query = Some(filter); }; + let mut builder = builder.with_model_projection(id_field)?; + builder.limit = limit; - let builder = builder.with_model_projection(id_field)?; let query = builder.build()?; let docs = query.execute(collection, session).await?; let ids = docs.into_iter().map(|mut doc| doc.remove("_id").unwrap()).collect();