Skip to content

Commit

Permalink
class variables consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Oct 4, 2023
1 parent 36c16dc commit ff9fd26
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/cmap/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export interface OpQueryOptions extends CommandOptions {
/** @internal */
export class Query {
ns: string;
query: Document;
numberToSkip: number;
numberToReturn: number;
returnFieldSelector?: Document;
Expand All @@ -74,7 +73,7 @@ export class Query {
partial: boolean;
documentsReturnedIn?: string;

constructor(public databaseName: string, query: Document, options: OpQueryOptions) {
constructor(public databaseName: string, public query: Document, options: OpQueryOptions) {
// Basic options needed to be passed in
// TODO(NODE-3483): Replace with MongoCommandError
const ns = `${databaseName}.$cmd`;
Expand All @@ -92,7 +91,6 @@ export class Query {

// Basic options
this.ns = ns;
this.query = query;

// Additional options
this.numberToSkip = options.numberToSkip || 0;
Expand Down Expand Up @@ -475,8 +473,6 @@ export interface OpMsgOptions {

/** @internal */
export class Msg {
command: Document;
options: OpQueryOptions;
requestId: number;
serializeFunctions: boolean;
ignoreUndefined: boolean;
Expand All @@ -486,13 +482,16 @@ export class Msg {
moreToCome: boolean;
exhaustAllowed: boolean;

constructor(public databaseName: string, command: Document, options: OpQueryOptions) {
constructor(
public databaseName: string,
public command: Document,
public options: OpQueryOptions
) {
// Basic options needed to be passed in
if (command == null)
throw new MongoInvalidArgumentError('Query document must be specified for query');

// Basic options
this.command = command;
this.command.$db = databaseName;

if (options.readPreference && options.readPreference.mode !== ReadPreference.PRIMARY) {
Expand Down

0 comments on commit ff9fd26

Please sign in to comment.