All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mongodb.internal.operation.FindAndDeleteOperation Maven / Gradle / Ivy

Go to download

The Java operations layer for the MongoDB Java Driver. Third parties can wrap this layer to provide custom higher-level APIs

There is a newer version: 5.3.0-beta0
Show newest version
/*
 * Copyright 2008-present MongoDB, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mongodb.internal.operation;

import com.mongodb.MongoNamespace;
import com.mongodb.WriteConcern;
import com.mongodb.client.model.Collation;
import com.mongodb.connection.ConnectionDescription;
import com.mongodb.internal.validator.NoOpFieldNameValidator;
import com.mongodb.lang.Nullable;
import org.bson.BsonBoolean;
import org.bson.BsonDocument;
import org.bson.BsonValue;
import org.bson.FieldNameValidator;
import org.bson.codecs.Decoder;

import java.util.concurrent.TimeUnit;

/**
 * An operation that atomically finds and deletes a single document.
 *
 * 

This class is not part of the public API and may be removed or changed at any time

*/ public class FindAndDeleteOperation extends BaseFindAndModifyOperation { public FindAndDeleteOperation(final MongoNamespace namespace, final WriteConcern writeConcern, final boolean retryWrites, final Decoder decoder) { super(namespace, writeConcern, retryWrites, decoder); } @Override public FindAndDeleteOperation filter(@Nullable final BsonDocument filter) { super.filter(filter); return this; } @Override public FindAndDeleteOperation projection(@Nullable final BsonDocument projection) { super.projection(projection); return this; } @Override public FindAndDeleteOperation maxTime(final long maxTime, final TimeUnit timeUnit) { super.maxTime(maxTime, timeUnit); return this; } @Override public FindAndDeleteOperation sort(@Nullable final BsonDocument sort) { super.sort(sort); return this; } @Override public FindAndDeleteOperation hint(@Nullable final BsonDocument hint) { super.hint(hint); return this; } @Override public FindAndDeleteOperation hintString(@Nullable final String hint) { super.hintString(hint); return this; } @Override public FindAndDeleteOperation collation(@Nullable final Collation collation) { super.collation(collation); return this; } @Override public FindAndDeleteOperation comment(@Nullable final BsonValue comment) { super.comment(comment); return this; } @Override public FindAndDeleteOperation let(@Nullable final BsonDocument variables) { super.let(variables); return this; } protected FieldNameValidator getFieldNameValidator() { return new NoOpFieldNameValidator(); } protected void specializeCommand(final BsonDocument commandDocument, final ConnectionDescription connectionDescription) { commandDocument.put("remove", BsonBoolean.TRUE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy